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