1 | <?php |
||
2 | /** |
||
3 | * Contains the settings class for LSX |
||
4 | * |
||
5 | * @package lsx-health-plan |
||
6 | */ |
||
7 | |||
8 | namespace lsx_health_plan\classes\admin; |
||
9 | |||
10 | /** |
||
11 | * Contains the settings for each post type \lsx_health_plan\classes\admin\Exercise(). |
||
12 | */ |
||
13 | class Exercise { |
||
14 | |||
15 | /** |
||
16 | * Holds class instance |
||
17 | * |
||
18 | * @since 1.0.0 |
||
19 | * |
||
20 | * @var object \lsx_health_plan\classes\admin\Exercise() |
||
21 | */ |
||
22 | protected static $instance = null; |
||
23 | |||
24 | /** |
||
25 | * Constructor |
||
26 | */ |
||
27 | public function __construct() { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
28 | add_action( 'lsx_hp_settings_page_exercise_top', array( $this, 'settings' ), 1, 1 ); |
||
29 | } |
||
0 ignored issues
–
show
|
|||
30 | |||
31 | /** |
||
32 | * Return an instance of this class. |
||
33 | * |
||
34 | * @since 1.0.0 |
||
35 | * |
||
36 | * @return object \lsx_health_plan\classes\admin\Exercise() A single instance of this class. |
||
37 | */ |
||
38 | public static function get_instance() { |
||
39 | // If the single instance hasn't been set, set it now. |
||
40 | if ( null === self::$instance ) { |
||
0 ignored issues
–
show
|
|||
41 | self::$instance = new self(); |
||
42 | } |
||
0 ignored issues
–
show
|
|||
43 | return self::$instance; |
||
44 | } |
||
0 ignored issues
–
show
|
|||
45 | |||
46 | /** |
||
47 | * Registers the general settings. |
||
48 | * |
||
49 | * @param object $cmb new_cmb2_box(). |
||
50 | * @return void |
||
51 | */ |
||
52 | public function settings( $cmb ) { |
||
53 | $cmb->add_field( |
||
54 | array( |
||
55 | 'name' => __( 'Exercises', 'lsx-health-plan' ), |
||
56 | 'id' => 'exercise_enabled', |
||
57 | 'type' => 'checkbox', |
||
58 | 'value' => 1, |
||
59 | 'default' => 0, |
||
60 | 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
||
61 | ) |
||
62 | ); |
||
63 | $cmb->add_field( |
||
64 | array( |
||
65 | 'id' => 'exercise_archive_description', |
||
66 | 'type' => 'wysiwyg', |
||
67 | 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
||
68 | 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
||
69 | 'options' => array( |
||
70 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
||
0 ignored issues
–
show
|
|||
71 | ), |
||
72 | ) |
||
73 | ); |
||
74 | $cmb->add_field( |
||
75 | array( |
||
76 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
||
77 | 'name' => __( 'Single Exercise Slug', 'lsx-health-plan' ), |
||
0 ignored issues
–
show
|
|||
78 | 'id' => 'endpoint_exercise_single', |
||
79 | 'type' => 'input', |
||
80 | 'value' => '', |
||
81 | 'default' => 'exercise', |
||
82 | ) |
||
83 | ); |
||
84 | $cmb->add_field( |
||
85 | array( |
||
86 | 'name' => __( 'Archive Exercise Slug', 'lsx-health-plan' ), |
||
0 ignored issues
–
show
|
|||
87 | 'id' => 'endpoint_exercise_archive', |
||
88 | 'type' => 'input', |
||
89 | 'value' => '', |
||
90 | 'default' => 'exercises', |
||
91 | ) |
||
92 | ); |
||
93 | $cmb->add_field( |
||
94 | array( |
||
95 | 'name' => __( 'Exercise Type Slug', 'lsx-health-plan' ), |
||
0 ignored issues
–
show
|
|||
96 | 'id' => 'endpoint_exercise_type', |
||
97 | 'type' => 'input', |
||
98 | 'value' => '', |
||
99 | 'default' => 'exercise-type', |
||
100 | ) |
||
101 | ); |
||
102 | $cmb->add_field( |
||
103 | array( |
||
104 | 'name' => __( 'Equipment Slug', 'lsx-health-plan' ), |
||
0 ignored issues
–
show
|
|||
105 | 'id' => 'endpoint_exercise_equipment', |
||
106 | 'type' => 'input', |
||
107 | 'value' => '', |
||
108 | 'default' => 'equipment', |
||
109 | ) |
||
110 | ); |
||
111 | $cmb->add_field( |
||
112 | array( |
||
113 | 'name' => __( 'Muscle Group Slug', 'lsx-health-plan' ), |
||
0 ignored issues
–
show
|
|||
114 | 'id' => 'endpoint_exercise_musclegroup', |
||
115 | 'type' => 'input', |
||
116 | 'value' => '', |
||
117 | 'default' => 'muscle-group', |
||
118 | 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
||
119 | ) |
||
120 | ); |
||
121 | } |
||
0 ignored issues
–
show
|
|||
122 | } |
||
123 | Exercise::get_instance(); |
||
124 |