author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 17:39:30 +0200 | |
changeset 7 | cf61fcea0001 |
parent 5 | 5e2f62d02dcd |
child 9 | 177826044cd9 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
5 | 3 |
* WordPress Customize Control classes |
0 | 4 |
* |
5 |
* @package WordPress |
|
6 |
* @subpackage Customize |
|
7 |
* @since 3.4.0 |
|
8 |
*/ |
|
5 | 9 |
|
10 |
/** |
|
11 |
* Customize Control class. |
|
12 |
* |
|
13 |
* @since 3.4.0 |
|
14 |
*/ |
|
0 | 15 |
class WP_Customize_Control { |
5 | 16 |
|
17 |
/** |
|
18 |
* Incremented with each new class instantiation, then stored in $instance_number. |
|
19 |
* |
|
20 |
* Used when sorting two instances whose priorities are equal. |
|
21 |
* |
|
22 |
* @since 4.1.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
24 |
* @static |
5 | 25 |
* @var int |
26 |
*/ |
|
27 |
protected static $instance_count = 0; |
|
28 |
||
29 |
/** |
|
30 |
* Order in which this instance was created in relation to other instances. |
|
31 |
* |
|
32 |
* @since 4.1.0 |
|
33 |
* @var int |
|
34 |
*/ |
|
35 |
public $instance_number; |
|
36 |
||
0 | 37 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
38 |
* Customizer manager. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
39 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
40 |
* @since 3.4.0 |
0 | 41 |
* @var WP_Customize_Manager |
42 |
*/ |
|
43 |
public $manager; |
|
44 |
||
45 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
46 |
* Control ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
47 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
48 |
* @since 3.4.0 |
0 | 49 |
* @var string |
50 |
*/ |
|
51 |
public $id; |
|
52 |
||
53 |
/** |
|
54 |
* All settings tied to the control. |
|
55 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
* @since 3.4.0 |
0 | 57 |
* @var array |
58 |
*/ |
|
59 |
public $settings; |
|
60 |
||
61 |
/** |
|
62 |
* The primary setting for the control (if there is one). |
|
63 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
64 |
* @since 3.4.0 |
0 | 65 |
* @var string |
66 |
*/ |
|
67 |
public $setting = 'default'; |
|
68 |
||
69 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
* Capability required to use this control. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
* Normally this is empty and the capability is derived from the capabilities |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
* of the associated `$settings`. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
75 |
* @since 4.5.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
* @var string |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
77 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
78 |
public $capability; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
79 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
81 |
* Order priority to load the control in Customizer. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
82 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
83 |
* @since 3.4.0 |
0 | 84 |
* @var int |
85 |
*/ |
|
5 | 86 |
public $priority = 10; |
0 | 87 |
|
88 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
* Section the control belongs to. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
90 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
91 |
* @since 3.4.0 |
0 | 92 |
* @var string |
93 |
*/ |
|
5 | 94 |
public $section = ''; |
0 | 95 |
|
96 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
97 |
* Label for the control. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
98 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
99 |
* @since 3.4.0 |
0 | 100 |
* @var string |
101 |
*/ |
|
5 | 102 |
public $label = ''; |
103 |
||
104 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
* Description for the control. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
* @since 4.0.0 |
5 | 108 |
* @var string |
109 |
*/ |
|
110 |
public $description = ''; |
|
0 | 111 |
|
112 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
113 |
* List of choices for 'radio' or 'select' type controls, where values are the keys, and labels are the values. |
0 | 114 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
115 |
* @since 3.4.0 |
0 | 116 |
* @var array |
117 |
*/ |
|
5 | 118 |
public $choices = array(); |
0 | 119 |
|
120 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
* List of custom input attributes for control output, where attribute names are the keys and values are the values. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
123 |
* Not used for 'checkbox', 'radio', 'select', 'textarea', or 'dropdown-pages' control types. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
124 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
125 |
* @since 4.0.0 |
0 | 126 |
* @var array |
127 |
*/ |
|
5 | 128 |
public $input_attrs = array(); |
129 |
||
130 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
131 |
* Show UI for adding new content, currently only used for the dropdown-pages control. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
132 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
133 |
* @since 4.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
134 |
* @var bool |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
135 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
136 |
public $allow_addition = false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
138 |
/** |
5 | 139 |
* @deprecated It is better to just call the json() method |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
140 |
* @since 3.4.0 |
5 | 141 |
* @var array |
142 |
*/ |
|
0 | 143 |
public $json = array(); |
144 |
||
145 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
146 |
* Control's Type. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
147 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
148 |
* @since 3.4.0 |
0 | 149 |
* @var string |
150 |
*/ |
|
151 |
public $type = 'text'; |
|
152 |
||
5 | 153 |
/** |
154 |
* Callback. |
|
155 |
* |
|
156 |
* @since 4.0.0 |
|
157 |
* |
|
158 |
* @see WP_Customize_Control::active() |
|
159 |
* |
|
160 |
* @var callable Callback is called with one argument, the instance of |
|
161 |
* WP_Customize_Control, and returns bool to indicate whether |
|
162 |
* the control is active (such as it relates to the URL |
|
163 |
* currently being previewed). |
|
164 |
*/ |
|
165 |
public $active_callback = ''; |
|
0 | 166 |
|
167 |
/** |
|
168 |
* Constructor. |
|
169 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
* Supplied `$args` override class property defaults. |
5 | 171 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
172 |
* If `$args['settings']` is not defined, use the $id as the setting ID. |
0 | 173 |
* |
174 |
* @since 3.4.0 |
|
175 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
* @param WP_Customize_Manager $manager Customizer bootstrap instance. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
177 |
* @param string $id Control ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
* @param array $args { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
* Optional. Arguments to override class property defaults. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
180 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
181 |
* @type int $instance_number Order in which this instance was created in relation |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
182 |
* to other instances. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
* @type WP_Customize_Manager $manager Customizer bootstrap instance. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
* @type string $id Control ID. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
* @type array $settings All settings tied to the control. If undefined, `$id` will |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
* be used. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
* @type string $setting The primary setting for the control (if there is one). |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
188 |
* Default 'default'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
* @type int $priority Order priority to load the control. Default 10. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
* @type string $section Section the control belongs to. Default empty. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
* @type string $label Label for the control. Default empty. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
* @type string $description Description for the control. Default empty. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
* @type array $choices List of choices for 'radio' or 'select' type controls, where |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
* values are the keys, and labels are the values. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
195 |
* Default empty array. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
* @type array $input_attrs List of custom input attributes for control output, where |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
197 |
* attribute names are the keys and values are the values. Not |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
198 |
* used for 'checkbox', 'radio', 'select', 'textarea', or |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
199 |
* 'dropdown-pages' control types. Default empty array. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
* @type array $json Deprecated. Use WP_Customize_Control::json() instead. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
* @type string $type Control type. Core controls include 'text', 'checkbox', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
* 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
* input types such as 'email', 'url', 'number', 'hidden', and |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
* 'date' are supported implicitly. Default 'text'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
205 |
* } |
0 | 206 |
*/ |
5 | 207 |
public function __construct( $manager, $id, $args = array() ) { |
0 | 208 |
$keys = array_keys( get_object_vars( $this ) ); |
209 |
foreach ( $keys as $key ) { |
|
5 | 210 |
if ( isset( $args[ $key ] ) ) { |
0 | 211 |
$this->$key = $args[ $key ]; |
5 | 212 |
} |
0 | 213 |
} |
214 |
||
215 |
$this->manager = $manager; |
|
216 |
$this->id = $id; |
|
5 | 217 |
if ( empty( $this->active_callback ) ) { |
218 |
$this->active_callback = array( $this, 'active_callback' ); |
|
219 |
} |
|
220 |
self::$instance_count += 1; |
|
221 |
$this->instance_number = self::$instance_count; |
|
0 | 222 |
|
223 |
// Process settings. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
if ( ! isset( $this->settings ) ) { |
0 | 225 |
$this->settings = $id; |
5 | 226 |
} |
0 | 227 |
|
228 |
$settings = array(); |
|
229 |
if ( is_array( $this->settings ) ) { |
|
230 |
foreach ( $this->settings as $key => $setting ) { |
|
231 |
$settings[ $key ] = $this->manager->get_setting( $setting ); |
|
232 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
233 |
} else if ( is_string( $this->settings ) ) { |
0 | 234 |
$this->setting = $this->manager->get_setting( $this->settings ); |
235 |
$settings['default'] = $this->setting; |
|
236 |
} |
|
237 |
$this->settings = $settings; |
|
238 |
} |
|
239 |
||
240 |
/** |
|
241 |
* Enqueue control related scripts/styles. |
|
242 |
* |
|
243 |
* @since 3.4.0 |
|
244 |
*/ |
|
245 |
public function enqueue() {} |
|
246 |
||
5 | 247 |
/** |
248 |
* Check whether control is active to current Customizer preview. |
|
249 |
* |
|
250 |
* @since 4.0.0 |
|
251 |
* |
|
252 |
* @return bool Whether the control is active to the current preview. |
|
253 |
*/ |
|
254 |
final public function active() { |
|
255 |
$control = $this; |
|
256 |
$active = call_user_func( $this->active_callback, $this ); |
|
257 |
||
258 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
259 |
* Filters response of WP_Customize_Control::active(). |
5 | 260 |
* |
261 |
* @since 4.0.0 |
|
262 |
* |
|
263 |
* @param bool $active Whether the Customizer control is active. |
|
264 |
* @param WP_Customize_Control $control WP_Customize_Control instance. |
|
265 |
*/ |
|
266 |
$active = apply_filters( 'customize_control_active', $active, $control ); |
|
267 |
||
268 |
return $active; |
|
269 |
} |
|
270 |
||
271 |
/** |
|
272 |
* Default callback used when invoking WP_Customize_Control::active(). |
|
273 |
* |
|
274 |
* Subclasses can override this with their specific logic, or they may |
|
275 |
* provide an 'active_callback' argument to the constructor. |
|
276 |
* |
|
277 |
* @since 4.0.0 |
|
278 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
* @return true Always true. |
5 | 280 |
*/ |
281 |
public function active_callback() { |
|
282 |
return true; |
|
283 |
} |
|
0 | 284 |
|
285 |
/** |
|
286 |
* Fetch a setting's value. |
|
287 |
* Grabs the main setting by default. |
|
288 |
* |
|
289 |
* @since 3.4.0 |
|
290 |
* |
|
291 |
* @param string $setting_key |
|
292 |
* @return mixed The requested setting's value, if the setting exists. |
|
293 |
*/ |
|
5 | 294 |
final public function value( $setting_key = 'default' ) { |
295 |
if ( isset( $this->settings[ $setting_key ] ) ) { |
|
0 | 296 |
return $this->settings[ $setting_key ]->value(); |
5 | 297 |
} |
0 | 298 |
} |
299 |
||
300 |
/** |
|
301 |
* Refresh the parameters passed to the JavaScript via JSON. |
|
302 |
* |
|
303 |
* @since 3.4.0 |
|
304 |
*/ |
|
305 |
public function to_json() { |
|
306 |
$this->json['settings'] = array(); |
|
307 |
foreach ( $this->settings as $key => $setting ) { |
|
308 |
$this->json['settings'][ $key ] = $setting->id; |
|
309 |
} |
|
310 |
||
311 |
$this->json['type'] = $this->type; |
|
5 | 312 |
$this->json['priority'] = $this->priority; |
313 |
$this->json['active'] = $this->active(); |
|
314 |
$this->json['section'] = $this->section; |
|
315 |
$this->json['content'] = $this->get_content(); |
|
316 |
$this->json['label'] = $this->label; |
|
317 |
$this->json['description'] = $this->description; |
|
318 |
$this->json['instanceNumber'] = $this->instance_number; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
319 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
320 |
if ( 'dropdown-pages' === $this->type ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
$this->json['allow_addition'] = $this->allow_addition; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
322 |
} |
5 | 323 |
} |
324 |
||
325 |
/** |
|
326 |
* Get the data to export to the client via JSON. |
|
327 |
* |
|
328 |
* @since 4.1.0 |
|
329 |
* |
|
330 |
* @return array Array of parameters passed to the JavaScript. |
|
331 |
*/ |
|
332 |
public function json() { |
|
333 |
$this->to_json(); |
|
334 |
return $this->json; |
|
0 | 335 |
} |
336 |
||
337 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
* Checks if the user can use this control. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
339 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
340 |
* Returns false if the user cannot manipulate one of the associated settings, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
341 |
* or if one of the associated settings does not exist. Also returns false if |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
342 |
* the associated section does not exist or if its capability check returns |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
343 |
* false. |
0 | 344 |
* |
345 |
* @since 3.4.0 |
|
346 |
* |
|
347 |
* @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true. |
|
348 |
*/ |
|
5 | 349 |
final public function check_capabilities() { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
351 |
return false; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
352 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
353 |
|
0 | 354 |
foreach ( $this->settings as $setting ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
355 |
if ( ! $setting || ! $setting->check_capabilities() ) { |
0 | 356 |
return false; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
357 |
} |
0 | 358 |
} |
359 |
||
360 |
$section = $this->manager->get_section( $this->section ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
361 |
if ( isset( $section ) && ! $section->check_capabilities() ) { |
0 | 362 |
return false; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
363 |
} |
0 | 364 |
|
365 |
return true; |
|
366 |
} |
|
367 |
||
368 |
/** |
|
5 | 369 |
* Get the control's content for insertion into the Customizer pane. |
370 |
* |
|
371 |
* @since 4.1.0 |
|
372 |
* |
|
373 |
* @return string Contents of the control. |
|
374 |
*/ |
|
375 |
final public function get_content() { |
|
376 |
ob_start(); |
|
377 |
$this->maybe_render(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
378 |
return trim( ob_get_clean() ); |
5 | 379 |
} |
380 |
||
381 |
/** |
|
0 | 382 |
* Check capabilities and render the control. |
383 |
* |
|
384 |
* @since 3.4.0 |
|
385 |
* @uses WP_Customize_Control::render() |
|
386 |
*/ |
|
5 | 387 |
final public function maybe_render() { |
0 | 388 |
if ( ! $this->check_capabilities() ) |
389 |
return; |
|
390 |
||
5 | 391 |
/** |
392 |
* Fires just before the current Customizer control is rendered. |
|
393 |
* |
|
394 |
* @since 3.4.0 |
|
395 |
* |
|
396 |
* @param WP_Customize_Control $this WP_Customize_Control instance. |
|
397 |
*/ |
|
0 | 398 |
do_action( 'customize_render_control', $this ); |
5 | 399 |
|
400 |
/** |
|
401 |
* Fires just before a specific Customizer control is rendered. |
|
402 |
* |
|
403 |
* The dynamic portion of the hook name, `$this->id`, refers to |
|
404 |
* the control ID. |
|
405 |
* |
|
406 |
* @since 3.4.0 |
|
407 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
408 |
* @param WP_Customize_Control $this WP_Customize_Control instance. |
5 | 409 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
410 |
do_action( "customize_render_control_{$this->id}", $this ); |
0 | 411 |
|
412 |
$this->render(); |
|
413 |
} |
|
414 |
||
415 |
/** |
|
5 | 416 |
* Renders the control wrapper and calls $this->render_content() for the internals. |
0 | 417 |
* |
418 |
* @since 3.4.0 |
|
419 |
*/ |
|
420 |
protected function render() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
421 |
$id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); |
0 | 422 |
$class = 'customize-control customize-control-' . $this->type; |
423 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
424 |
printf( '<li id="%s" class="%s">', esc_attr( $id ), esc_attr( $class ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
425 |
$this->render_content(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
426 |
echo '</li>'; |
0 | 427 |
} |
428 |
||
429 |
/** |
|
5 | 430 |
* Get the data link attribute for a setting. |
0 | 431 |
* |
432 |
* @since 3.4.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
433 |
* @since 4.9.0 Return a `data-customize-setting-key-link` attribute if a setting is not registered for the supplied setting key. |
0 | 434 |
* |
435 |
* @param string $setting_key |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
436 |
* @return string Data link parameter, a `data-customize-setting-link` attribute if the `$setting_key` refers to a pre-registered setting, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
437 |
* and a `data-customize-setting-key-link` attribute if the setting is not yet registered. |
0 | 438 |
*/ |
439 |
public function get_link( $setting_key = 'default' ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
440 |
if ( isset( $this->settings[ $setting_key ] ) && $this->settings[ $setting_key ] instanceof WP_Customize_Setting ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
441 |
return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
442 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
443 |
return 'data-customize-setting-key-link="' . esc_attr( $setting_key ) . '"'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
444 |
} |
0 | 445 |
} |
446 |
||
447 |
/** |
|
5 | 448 |
* Render the data link attribute for the control's input element. |
0 | 449 |
* |
450 |
* @since 3.4.0 |
|
451 |
* @uses WP_Customize_Control::get_link() |
|
452 |
* |
|
453 |
* @param string $setting_key |
|
454 |
*/ |
|
455 |
public function link( $setting_key = 'default' ) { |
|
456 |
echo $this->get_link( $setting_key ); |
|
457 |
} |
|
458 |
||
459 |
/** |
|
5 | 460 |
* Render the custom attributes for the control's input element. |
461 |
* |
|
462 |
* @since 4.0.0 |
|
463 |
*/ |
|
464 |
public function input_attrs() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
465 |
foreach ( $this->input_attrs as $attr => $value ) { |
5 | 466 |
echo $attr . '="' . esc_attr( $value ) . '" '; |
467 |
} |
|
468 |
} |
|
469 |
||
470 |
/** |
|
0 | 471 |
* Render the control's content. |
472 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
473 |
* Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`. |
5 | 474 |
* |
475 |
* Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`. |
|
476 |
* Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly. |
|
477 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
478 |
* Control content can alternately be rendered in JS. See WP_Customize_Control::print_template(). |
0 | 479 |
* |
480 |
* @since 3.4.0 |
|
481 |
*/ |
|
482 |
protected function render_content() { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
483 |
$input_id = '_customize-input-' . $this->id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
$description_id = '_customize-description-' . $this->id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
485 |
$describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
486 |
switch ( $this->type ) { |
0 | 487 |
case 'checkbox': |
488 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
489 |
<span class="customize-inside-control-row"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
490 |
<input |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
491 |
id="<?php echo esc_attr( $input_id ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
492 |
<?php echo $describedby_attr; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
493 |
type="checkbox" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
494 |
value="<?php echo esc_attr( $this->value() ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
495 |
<?php $this->link(); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
496 |
<?php checked( $this->value() ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
497 |
/> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
498 |
<label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $this->label ); ?></label> |
5 | 499 |
<?php if ( ! empty( $this->description ) ) : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
500 |
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
5 | 501 |
<?php endif; ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
502 |
</span> |
0 | 503 |
<?php |
504 |
break; |
|
505 |
case 'radio': |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
506 |
if ( empty( $this->choices ) ) { |
0 | 507 |
return; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
508 |
} |
0 | 509 |
|
510 |
$name = '_customize-radio-' . $this->id; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
511 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
512 |
<?php if ( ! empty( $this->label ) ) : ?> |
5 | 513 |
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
514 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
515 |
<?php if ( ! empty( $this->description ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
516 |
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description ; ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
517 |
<?php endif; ?> |
5 | 518 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
519 |
<?php foreach ( $this->choices as $value => $label ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
520 |
<span class="customize-inside-control-row"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
521 |
<input |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
522 |
id="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
523 |
type="radio" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
524 |
<?php echo $describedby_attr; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
525 |
value="<?php echo esc_attr( $value ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
526 |
name="<?php echo esc_attr( $name ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
527 |
<?php $this->link(); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
528 |
<?php checked( $this->value(), $value ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
529 |
/> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
530 |
<label for="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"><?php echo esc_html( $label ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
531 |
</span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
532 |
<?php endforeach; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
533 |
<?php |
0 | 534 |
break; |
535 |
case 'select': |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
536 |
if ( empty( $this->choices ) ) { |
0 | 537 |
return; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
538 |
} |
0 | 539 |
|
540 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
541 |
<?php if ( ! empty( $this->label ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
542 |
<label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
543 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
544 |
<?php if ( ! empty( $this->description ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
545 |
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
546 |
<?php endif; ?> |
5 | 547 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
548 |
<select id="<?php echo esc_attr( $input_id ); ?>" <?php echo $describedby_attr; ?> <?php $this->link(); ?>> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
549 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
550 |
foreach ( $this->choices as $value => $label ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
551 |
echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
552 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
553 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
554 |
</select> |
0 | 555 |
<?php |
556 |
break; |
|
5 | 557 |
case 'textarea': |
558 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
559 |
<?php if ( ! empty( $this->label ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
560 |
<label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
561 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
562 |
<?php if ( ! empty( $this->description ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
563 |
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
564 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
565 |
<textarea |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
566 |
id="<?php echo esc_attr( $input_id ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
567 |
rows="5" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
568 |
<?php echo $describedby_attr; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
569 |
<?php $this->input_attrs(); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
570 |
<?php $this->link(); ?>> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
571 |
<?php echo esc_textarea( $this->value() ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
572 |
</textarea> |
5 | 573 |
<?php |
574 |
break; |
|
0 | 575 |
case 'dropdown-pages': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
576 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
577 |
<?php if ( ! empty( $this->label ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
578 |
<label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
579 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
580 |
<?php if ( ! empty( $this->description ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
581 |
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
582 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
583 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
584 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
585 |
$dropdown_name = '_customize-dropdown-pages-' . $this->id; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
586 |
$show_option_none = __( '— Select —' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
587 |
$option_none_value = '0'; |
0 | 588 |
$dropdown = wp_dropdown_pages( |
589 |
array( |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
590 |
'name' => $dropdown_name, |
0 | 591 |
'echo' => 0, |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
592 |
'show_option_none' => $show_option_none, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
593 |
'option_none_value' => $option_none_value, |
0 | 594 |
'selected' => $this->value(), |
595 |
) |
|
596 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
597 |
if ( empty( $dropdown ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
598 |
$dropdown = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $dropdown_name ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
599 |
$dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
600 |
$dropdown .= '</select>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
601 |
} |
0 | 602 |
|
603 |
// Hackily add in the data link parameter. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
604 |
$dropdown = str_replace( '<select', '<select ' . $this->get_link() . ' id="' . esc_attr( $input_id ) . '" ' . $describedby_attr, $dropdown ); |
0 | 605 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
606 |
// Even more hacikly add auto-draft page stubs. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
607 |
// @todo Eventually this should be removed in favor of the pages being injected into the underlying get_pages() call. See <https://github.com/xwp/wp-customize-posts/pull/250>. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
608 |
$nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
609 |
if ( $nav_menus_created_posts_setting && current_user_can( 'publish_pages' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
610 |
$auto_draft_page_options = ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
611 |
foreach ( $nav_menus_created_posts_setting->value() as $auto_draft_page_id ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
612 |
$post = get_post( $auto_draft_page_id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
613 |
if ( $post && 'page' === $post->post_type ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
614 |
$auto_draft_page_options .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $post->ID ), esc_html( $post->post_title ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
615 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
616 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
617 |
if ( $auto_draft_page_options ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
618 |
$dropdown = str_replace( '</select>', $auto_draft_page_options . '</select>', $dropdown ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
619 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
620 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
621 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
622 |
echo $dropdown; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
623 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
624 |
<?php if ( $this->allow_addition && current_user_can( 'publish_pages' ) && current_user_can( 'edit_theme_options' ) ) : // Currently tied to menus functionality. ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
625 |
<button type="button" class="button-link add-new-toggle"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
626 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
627 |
/* translators: %s: add new page label */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
628 |
printf( __( '+ %s' ), get_post_type_object( 'page' )->labels->add_new_item ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
629 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
630 |
</button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
631 |
<div class="new-content-item"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
632 |
<label for="create-input-<?php echo $this->id; ?>"><span class="screen-reader-text"><?php _e( 'New page title' ); ?></span></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
633 |
<input type="text" id="create-input-<?php echo $this->id; ?>" class="create-item-input" placeholder="<?php esc_attr_e( 'New page title…' ); ?>"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
634 |
<button type="button" class="button add-content"><?php _e( 'Add' ); ?></button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
635 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
636 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
637 |
<?php |
0 | 638 |
break; |
5 | 639 |
default: |
640 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
641 |
<?php if ( ! empty( $this->label ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
642 |
<label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
643 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
644 |
<?php if ( ! empty( $this->description ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
645 |
<span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
646 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
647 |
<input |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
648 |
id="<?php echo esc_attr( $input_id ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
649 |
type="<?php echo esc_attr( $this->type ); ?>" |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
650 |
<?php echo $describedby_attr; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
651 |
<?php $this->input_attrs(); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
652 |
<?php if ( ! isset( $this->input_attrs['value'] ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
653 |
value="<?php echo esc_attr( $this->value() ); ?>" |
5 | 654 |
<?php endif; ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
655 |
<?php $this->link(); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
656 |
/> |
5 | 657 |
<?php |
658 |
break; |
|
0 | 659 |
} |
660 |
} |
|
5 | 661 |
|
662 |
/** |
|
663 |
* Render the control's JS template. |
|
664 |
* |
|
665 |
* This function is only run for control types that have been registered with |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
666 |
* WP_Customize_Manager::register_control_type(). |
5 | 667 |
* |
668 |
* In the future, this will also print the template for the control's container |
|
669 |
* element and be override-able. |
|
670 |
* |
|
671 |
* @since 4.1.0 |
|
672 |
*/ |
|
673 |
final public function print_template() { |
|
674 |
?> |
|
675 |
<script type="text/html" id="tmpl-customize-control-<?php echo $this->type; ?>-content"> |
|
676 |
<?php $this->content_template(); ?> |
|
677 |
</script> |
|
678 |
<?php |
|
679 |
} |
|
680 |
||
681 |
/** |
|
682 |
* An Underscore (JS) template for this control's content (but not its container). |
|
683 |
* |
|
684 |
* Class variables for this control class are available in the `data` JS object; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
685 |
* export custom variables by overriding WP_Customize_Control::to_json(). |
5 | 686 |
* |
687 |
* @see WP_Customize_Control::print_template() |
|
688 |
* |
|
689 |
* @since 4.1.0 |
|
690 |
*/ |
|
691 |
protected function content_template() {} |
|
692 |
||
0 | 693 |
} |
694 |
||
695 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
696 |
* WP_Customize_Color_Control class. |
0 | 697 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
698 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php' ); |
0 | 699 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
700 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
701 |
* WP_Customize_Media_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
702 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
703 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php' ); |
0 | 704 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
705 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
706 |
* WP_Customize_Upload_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
707 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
708 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php' ); |
0 | 709 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
710 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
711 |
* WP_Customize_Image_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
712 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
713 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php' ); |
0 | 714 |
|
715 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
716 |
* WP_Customize_Background_Image_Control class. |
0 | 717 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
718 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' ); |
5 | 719 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
720 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
721 |
* WP_Customize_Background_Position_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
722 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
723 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php' ); |
0 | 724 |
|
5 | 725 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
726 |
* WP_Customize_Cropped_Image_Control class. |
5 | 727 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
728 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' ); |
5 | 729 |
|
730 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
731 |
* WP_Customize_Site_Icon_Control class. |
5 | 732 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
733 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' ); |
0 | 734 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
735 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
736 |
* WP_Customize_Header_Image_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
737 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
738 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' ); |
0 | 739 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
740 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
741 |
* WP_Customize_Theme_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
742 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
743 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' ); |
0 | 744 |
|
745 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
746 |
* WP_Widget_Area_Customize_Control class. |
0 | 747 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
748 |
require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
749 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
750 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
751 |
* WP_Widget_Form_Customize_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
752 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
753 |
require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' ); |
0 | 754 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
755 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
756 |
* WP_Customize_Nav_Menu_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
757 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
758 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' ); |
0 | 759 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
760 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
761 |
* WP_Customize_Nav_Menu_Item_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
762 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
763 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' ); |
0 | 764 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
765 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
766 |
* WP_Customize_Nav_Menu_Location_Control class. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
767 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
768 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' ); |
0 | 769 |
|
770 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
771 |
* WP_Customize_Nav_Menu_Name_Control class. |
0 | 772 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
773 |
* As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
774 |
* release, the require_once() here will be removed and _deprecated_file() will be called if file is |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
775 |
* required at all. |
5 | 776 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
777 |
* @deprecated 4.9.0 This file is no longer used due to new menu creation UX. |
0 | 778 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
779 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' ); |
0 | 780 |
|
5 | 781 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
782 |
* WP_Customize_Nav_Menu_Locations_Control class. |
5 | 783 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
784 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php' ); |
0 | 785 |
|
5 | 786 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
787 |
* WP_Customize_Nav_Menu_Auto_Add_Control class. |
5 | 788 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
789 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' ); |
5 | 790 |
|
791 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
792 |
* WP_Customize_Date_Time_Control class. |
5 | 793 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
794 |
require_once( ABSPATH . WPINC . '/customize/class-wp-customize-date-time-control.php' ); |