-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.example.php
225 lines (221 loc) · 6.44 KB
/
settings.example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
/**
* The example settings configuration file.
*
* @package ThoughtfulWeb\SettingsPageWP
* @author Zachary Kendall Watkins <watkinza@gmail.com>
* @copyright Zachary Kendall Watkins 2022
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
* @link https://github.com/thoughtful-web/settings-page-wp/blob/main/config/thoughtful-web/settings.example.php
* @since 0.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
http_response_code( 404 );
?><html><head><title>HTTP 404 Not Found</title></head><body><p>The requested page does not exist.</p></body></html>
<?php
die();
}
return array(
'method_args' => array(
'page_title' => 'A Thoughtful Settings Page',
'menu_title' => 'Thoughtful Settings',
'capability' => 'manage_options',
'menu_slug' => 'thoughtful-settings',
'icon_url' => 'dashicons-admin-settings',
'position' => 2,
),
'option_group' => 'thoughtful_settings',
'description' => 'A thoughtful settings page description.',
'stylesheet' => array(
'file' => '/css/settings.css',
'deps' => array(),
),
'script' => array(
'file' => '/scripts/settings.js',
'deps' => array(),
'in_footer' => true,
),
'sections' => array(
array(
'section' => 'unique-section-id-1',
'title' => 'Section One',
'description' => 'A description for Section One',
'fields' => array(
array(
'label' => 'My Text Field',
'id' => 'unique_text_field',
'type' => 'text',
'description' => 'My text field description',
'data_args' => array(
'placeholder' => 'my placeholder',
'default' => 'A thoughtful, optional, default value',
'data-lpignore' => 'true',
'size' => '40',
),
),
array(
'label' => 'My Color Field',
'id' => 'unique_color_field',
'type' => 'color',
'description' => 'My color field description',
'data_args' => array(
'default' => '#000000',
),
),
array(
'label' => 'My Textarea Field',
'id' => 'unique_textarea_field',
'type' => 'textarea',
'description' => 'My textarea field',
'data_args' => array(
'placeholder' => 'my placeholder',
),
),
array(
'label' => 'My Checkbox Field',
'id' => 'unique_checkbox_field',
'type' => 'checkbox',
'description' => 'My checkbox field description',
'choice' => array(
'1' => 'My Choice',
),
'data_args' => array(
'default' => '1',
),
),
array(
'label' => 'My Checkbox Fields',
'id' => 'unique_checkbox_fields',
'type' => 'checkbox',
'description' => 'My checkbox fields description',
'choices' => array(
'option_one' => 'Option 1',
'option_two' => 'Option 2',
'option_three' => 'Option 3',
),
'data_args' => array(
'default' => array(
'option_one',
'option_two',
),
),
),
),
),
array(
'section' => 'unique-section-id-2',
'title' => 'Section Two',
'description' => 'Section Two description text',
'fields' => array(
array(
'label' => 'My WP Editor Field',
'id' => 'unique_wp_editor_field',
'type' => 'wp_editor',
'description' => 'My WP Editor field description',
'data_args' => array(
'default' => 'my default value',
),
),
array(
'label' => 'My Decimal Number Field',
'id' => 'unique_decimal_number_field',
'type' => 'number',
'description' => 'My number field description',
'data_args' => array(
'placeholder' => 'Multiple of 0.1',
'step' => '0.1',
'min' => '0',
'max' => '10',
),
),
array(
'label' => 'My Negative Number Field',
'id' => 'unique_negative_number_field',
'type' => 'number',
'description' => 'My negative number field description',
'data_args' => array(
'placeholder' => 'Multiple of -1',
'step' => '1',
'min' => '-10',
'max' => '0',
),
),
array(
'label' => 'My Radio Field',
'id' => 'unique_radio_field',
'type' => 'radio',
'description' => 'My radio field description',
'choices' => array(
'option_one' => 'Option 1',
'option_two' => 'Option 2',
'option_three' => 'Option 3',
),
),
array(
'label' => 'My Select Field',
'id' => 'unique_select_field',
'type' => 'select',
'description' => 'My select field description',
'choices' => array(
'option_one' => 'Option 1',
'option_two' => 'Option 2',
'option_three' => 'Option 3',
),
),
array(
'label' => 'My Multi-select Field',
'id' => 'unique_multiselect_field',
'type' => 'select',
'description' => 'My multi-select field description',
'choices' => array(
'option_one' => 'Option 1',
'option_two' => 'Option 2',
'option_three' => 'Option 3',
),
'data_args' => array(
'multiple' => true,
'default' => array( 'option_one', 'option_two' ),
),
),
array(
'label' => 'My Email Field',
'id' => 'unique_email_field',
'type' => 'email',
'description' => 'My email field description',
'data_args' => array(
'placeholder' => 'my placeholder',
),
),
array(
'label' => 'My Phone Field',
'id' => 'unique_phone_field',
'type' => 'tel',
'description' => 'Example: 555-555-5555',
'data_args' => array(
'placeholder' => '555-555-5555',
'pattern' => '[0-9]{3}-[0-9]{3}-[0-9]{4}',
),
),
array(
'label' => 'My URL Field',
'id' => 'unique_url_field',
'type' => 'url',
'description' => 'Must have the "https" protocol. Example: https://example.com/',
'data_args' => array(
'placeholder' => 'https://example.com/',
'pattern' => 'https://.*',
),
),
array(
'id' => 'api_key',
'label' => 'API Key',
'type' => 'password',
'description' => 'An API key used to access data.',
'data_args' => array(
'copy_button' => 'Copy API key',
),
),
),
),
),
);