PluginProbe
QuadMenu – Mega Menu / 3.3.3
QuadMenu – Mega Menu v3.3.3
3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 87 releases
quadmenu / lib / class-options.php

class-options.php in QuadMenu – Mega Menu 3.3.3, at lib/class-options.php

2,314 lines 84.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace QuadLayers\QuadMenu;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 die( '-1' );
7 }
8
9 use QuadLayers\QuadMenu\Plugin;
10
11 /**
12 * Options Class ex QuadMenu_Options
13 */
14 class Options {
15
16 private $defaults = array();
17
18 private static $instance;
19
20 public function __construct() {
21
22 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/options', array( $this, 'developer' ) );
23 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/global_variable', array( $this, 'developer' ) );
24 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/global_variable', array( $this, 'compatibility' ) );
25 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/ajax_save/response', array( $this, 'developer_ajax' ) );
26
27 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/sections', array( $this, 'configuration' ) );
28 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/sections', array( $this, 'locations' ) );
29 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/sections', array( $this, 'responsive' ) );
30 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/sections', array( $this, 'themes' ) );
31 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/sections', array( $this, 'css' ) );
32
33 if ( ! is_admin() && ! is_customize_preview() ) {
34 return;
35 }
36
37 add_filter( 'redux/page/' . QUADMENU_DB_OPTIONS . '/form/before', array( $this, 'remove' ) );
38 }
39
40 // Comaptibility with old versions
41 // -------------------------------------------------------------------------
42 function compatibility( $options ) {
43 foreach ( $options as $key => $value ) {
44
45 if ( is_array( $value ) && isset( $value['color'] ) && isset( $value['alpha'] ) ) {
46 $options[ $key ] = \ReduxLegacy_Helpers::hex2rgba( $value['color'], $value['alpha'] );
47 }
48 }
49
50 return $options;
51 }
52
53 function developer( $options = array() ) {
54
55 $developer = apply_filters( 'quadmenu_developer_options', array() );
56
57 if ( ! empty( $developer ) && is_array( $developer ) ) {
58
59 $options = array_merge( $options, $developer );
60
61 foreach ( $developer as $id => $value ) {
62
63 add_filter( 'redux/options/' . QUADMENU_DB_OPTIONS . '/field/' . $id, '__return_null' );
64 }
65 }
66
67 return $options;
68 }
69
70 function developer_ajax( $return_array ) {
71
72 $return_array['options'] = apply_filters( 'quadmenu_developer_options', $return_array['options'] );
73
74 return $return_array;
75 }
76
77 function remove( $redux ) {
78
79 $class = '';
80
81 foreach ( $redux->parent->sections as $key => $section ) {
82
83 if ( empty( $section['fields'] ) ) {
84
85 if ( isset( $redux->parent->sections[ $key ]['class'] ) ) {
86
87 $class = ' ' . $redux->parent->sections[ $key ]['class'];
88 }
89
90 $redux->parent->sections[ $key ]['class'] = 'empty_section' . $class;
91 }
92 }
93
94 return $redux->parent->sections;
95 }
96
97 function configuration( $sections ) {
98
99 $this->defaults = apply_filters( 'quadmenu_default_options', array() );
100
101 $sections[] = array(
102 // 'customizer' => true,
103 'id' => 'quadmenu_configuration',
104 'title' => esc_html__( 'Configuration', 'quadmenu' ),
105 'heading' => false,
106 'icon' => 'dashicons dashicons-admin-generic',
107 'permissions' => 'manage_options',
108 'fields' => array(
109 array(
110 'customizer' => false,
111 'compiler' => false,
112 'id' => 'viewport',
113 'type' => 'switch',
114 'title' => esc_html__( 'Viewport', 'quadmenu' ),
115 'subtitle' => esc_html__( 'Include the viewport meta tag in site head.', 'quadmenu' ),
116 'default' => (bool) $this->defaults['viewport'],
117 ),
118 array(
119 'customizer' => false,
120 'compiler' => false,
121 'id' => 'styles',
122 'type' => 'switch',
123 'title' => esc_html__( 'Stylesheet', 'quadmenu' ),
124 'subtitle' => esc_html__( 'Load styles in your theme.', 'quadmenu' ),
125 'compiler' => false,
126 'default' => (bool) $this->defaults['styles'],
127 ),
128 array(
129 'customizer' => true,
130 'transport' => 'refresh',
131 'compiler' => false,
132 'id' => 'styles_normalize',
133 'type' => 'switch',
134 'title' => esc_html__( 'Normalize', 'quadmenu' ),
135 'subtitle' => esc_html__( 'Try to clean residual styling of the theme.', 'quadmenu' ),
136 'required' => array(
137 'styles',
138 '=',
139 1,
140 ),
141 'default' => (bool) $this->defaults['styles_normalize'],
142 ),
143 array(
144 'customizer' => true,
145 'transport' => 'refresh',
146 'compiler' => false,
147 'id' => 'styles_widgets',
148 'type' => 'switch',
149 'title' => esc_html__( 'Widgets', 'quadmenu' ),
150 'subtitle' => esc_html__( 'Load default widgets stylesheets.', 'quadmenu' ),
151 'required' => array(
152 'styles',
153 '=',
154 1,
155 ),
156 'default' => (bool) $this->defaults['styles_widgets'],
157 ),
158 array(
159 'customizer' => true,
160 'transport' => 'refresh',
161 'compiler' => false,
162 'id' => 'styles_pscrollbar',
163 'type' => 'switch',
164 'title' => esc_html__( 'Perfect ScrollBar', 'quadmenu' ),
165 'subtitle' => esc_html__( 'Load Perfect scroll bar files.', 'quadmenu' ),
166 'default' => (bool) $this->defaults['styles_pscrollbar'],
167 ),
168 array(
169 'customizer' => false,
170 'compiler' => false,
171 'id' => 'styles_owlcarousel',
172 'type' => 'switch',
173 'title' => esc_html__( 'OWL Carousel', 'quadmenu' ),
174 'subtitle' => esc_html__( 'Load OWL Carousel files.', 'quadmenu' ),
175 'default' => (bool) $this->defaults['styles_owlcarousel'],
176 ),
177 array(
178 'customizer' => false,
179 'compiler' => false,
180 'id' => 'styles_icons',
181 'type' => 'select',
182 'options' => Plugin::instance()->registered_icons_names(),
183 'title' => esc_html__( 'Icons', 'quadmenu' ),
184 'subtitle' => esc_html__( 'Select the fonticon for your menus.', 'quadmenu' ),
185 'select2' => array(
186 'allowClear' => false,
187 ),
188 'required' => array(
189 'styles',
190 '=',
191 1,
192 ),
193 'default' => $this->defaults['styles_icons'],
194 'validate' => 'no_special_chars',
195 ),
196 ),
197 );
198
199 return $sections;
200 }
201
202 function css( $sections ) {
203
204 $this->defaults = apply_filters( 'quadmenu_default_options', array() );
205
206 $sections[] = array(
207 'heading' => false,
208 'id' => 'quadmenu_css',
209 'title' => esc_html__( 'Customize', 'quadmenu' ),
210 'icon' => 'dashicons dashicons-editor-code',
211 'permissions' => 'edit_theme_options',
212 'fields' => array(
213 array(
214 'customizer' => true,
215 'transport' => 'refresh',
216 'compiler' => false,
217 'id' => 'css',
218 'type' => 'ace_editor',
219 'mode' => 'css',
220 'title' => esc_html__( 'CSS', 'quadmenu' ),
221 'subtitle' => esc_html__( 'Quickly add some CSS to your theme by adding it to this block.', 'quadmenu' ),
222 'theme' => 'chrome',
223 'default' => $this->defaults['css'],
224 ),
225 ),
226 );
227
228 return $sections;
229 }
230
231 function locations( $sections ) {
232
233 global $quadmenu_locations;
234
235 $theme = get_stylesheet();
236
237 $all_locations_defaults = apply_filters( 'quadmenu_default_options_locations', array() );
238
239 foreach ( $quadmenu_locations as $id => $location ) {
240
241 $current_location_defaults = apply_filters( 'quadmenu_default_options_location_' . $id, $all_locations_defaults );
242
243 foreach ( $current_location_defaults as $key => $value ) {
244
245 $this->defaults[ "{$id}_{$key}" ] = $value;
246 }
247 }
248
249 $this->defaults = apply_filters( 'quadmenu_default_options', $this->defaults );
250
251 foreach ( $quadmenu_locations as $id => $location ) {
252
253 extract( $location );
254
255 $sections[] = array(
256 // 'customizer' => true,
257 'subsection' => true,
258 'heading' => false,
259 'icon' => 'dashicons dashicons-editor-insertmore',
260 'id' => 'quadmenu_location_' . $id,
261 'title' => $name,
262 'permissions' => 'edit_theme_options',
263 'fields' => array(
264 array(
265 'customizer' => true,
266 'transport' => 'refresh',
267 'id' => $id . '_integration',
268 'type' => 'switch',
269 'title' => esc_html__( 'Integration', 'quadmenu' ),
270 'subtitle' => esc_html__( 'Integrate QuadMenu in this theme location.', 'quadmenu' ),
271 'default' => $this->defaults[ $id . '_integration' ],
272 ),
273 array(
274 'customizer' => true,
275 'transport' => 'refresh',
276 'id' => $id . '_unwrap',
277 'type' => 'switch',
278 'title' => esc_html__( 'Conflicts', 'quadmenu' ),
279 'subtitle' => esc_html__( 'Try to solve conflicts of residual theme style.', 'quadmenu' ),
280 'default' => $this->defaults[ $id . '_unwrap' ],
281 'required' => array(
282 $id . '_integration',
283 '=',
284 1,
285 ),
286 ),
287 array(
288 'customizer' => true,
289 'transport' => 'refresh',
290 'type' => 'select',
291 'id' => $id . '_theme',
292 'title' => __( 'Theme', 'quadmenu' ),
293 'subtitle' => __( 'Select a theme for this theme location', 'quadmenu' ),
294 'class' => 'current_theme',
295 'options' => (array) $GLOBALS['quadmenu_themes'],
296 'default' => $this->defaults[ $id . '_theme' ],
297 ),
298 array(
299 'customizer' => false,
300 'id' => $id . '_information',
301 'type' => 'info',
302 'title' => esc_html__( 'Integration', 'quadmenu' ),
303 'style' => 'success',
304 'desc' => sprintf( '<p>%s</p>', esc_html__( 'If your menu doesn\'t seem to be working properly after using Automatic Integration, the most common scenario is that you have residual styling from your theme and would need to use Manual Integration instead.', 'quadmenu' ) ),
305 'required' => array(
306 $id . '_integration',
307 '=',
308 1,
309 ),
310 ),
311 array(
312 'customizer' => false,
313 'id' => $id . '_manual',
314 'type' => 'info',
315 'title' => esc_html__( 'Manual Integration', 'quadmenu' ),
316 'style' => 'info',
317 'class' => 'info_manual',
318 'desc' => sprintf( '<p>%s</p><p><code>&lt;?php quadmenu(array(&quot;theme_location&quot; => &quot;%s&quot;, &quot;theme&quot; => &quot;<span class="current_theme">%s</span>&quot;)); ?&gt;</code></p>', esc_html__( 'Copy the generated PHP function code and paste it into the appropriate template in your theme.', 'quadmenu' ), $id, 'default_theme' ),
319 ),
320 ),
321 );
322 }
323
324 return $sections;
325 }
326
327 function responsive( $sections ) {
328
329 $this->defaults = apply_filters( 'quadmenu_default_options', array() );
330
331 $sections[] = array(
332 'customizer' => true,
333 'heading' => false,
334 'id' => 'quadmenu_responsive',
335 'title' => esc_html__( 'Responsive', 'quadmenu' ),
336 'icon' => 'dashicons dashicons-desktop',
337 'permissions' => 'edit_theme_options',
338 'fields' => array(
339 array(
340 'compiler' => true,
341 'id' => 'gutter',
342 'type' => 'slider',
343 'title' => esc_html__( 'Gutter', 'quadmenu' ),
344 'subtitle' => esc_html__( 'Padding between columns.', 'quadmenu' ),
345 'min' => '0',
346 'step' => '2',
347 'max' => '60',
348 'default' => (int) $this->defaults['gutter'],
349 'validate' => 'numeric',
350 ),
351 array(
352 'compiler' => true,
353 'id' => 'screen_sm_width',
354 'type' => 'slider',
355 'title' => esc_html__( 'Screen Small', 'quadmenu' ),
356 'subtitle' => esc_html__( 'Small screens breakpoint.', 'quadmenu' ),
357 'min' => '480',
358 'step' => '1',
359 'max' => '1000',
360 'default' => (int) $this->defaults['screen_sm_width'],
361 'validate' => 'numeric',
362 ),
363 array(
364 'compiler' => true,
365 'id' => 'screen_md_width',
366 'type' => 'slider',
367 'title' => esc_html__( 'Screen Medium', 'quadmenu' ),
368 'subtitle' => esc_html__( 'Medium screens breakpoint.', 'quadmenu' ),
369 'min' => '481',
370 'step' => '1',
371 'max' => '1200',
372 'default' => (int) $this->defaults['screen_md_width'],
373 'validate' => 'numeric',
374 ),
375 array(
376 'compiler' => true,
377 'id' => 'screen_lg_width',
378 'type' => 'slider',
379 'title' => esc_html__( 'Screen Large', 'quadmenu' ),
380 'subtitle' => esc_html__( 'Large screens breakpoint.', 'quadmenu' ),
381 'min' => '801',
382 'step' => '1',
383 'max' => '1600',
384 'default' => (int) $this->defaults['screen_lg_width'],
385 'validate' => 'numeric',
386 ),
387 ),
388 );
389
390 return $sections;
391 }
392
393 function themes( $sections ) {
394
395 global $quadmenu_themes;
396
397 $all_themes_defaults = apply_filters( 'quadmenu_default_options_themes', array() );
398
399 foreach ( $quadmenu_themes as $theme => $name ) {
400
401 $current_theme_defaults = apply_filters( 'quadmenu_default_options_theme_' . $theme, $all_themes_defaults );
402
403 foreach ( $current_theme_defaults as $key => $value ) {
404
405 $this->defaults[ "{$theme}_{$key}" ] = $value;
406 }
407 }
408
409 $this->defaults = apply_filters( 'quadmenu_default_options', $this->defaults );
410
411 foreach ( $quadmenu_themes as $key => $theme ) {
412
413 $sections[] = array(
414 // 'customizer' => true,
415 'customizer_title' => esc_html( 'Layout', 'quadmenu' ),
416 'subsection' => false,
417 'heading' => false,
418 'id' => 'quadmenu_layout_' . $key,
419 'title' => $theme,
420 'icon' => 'dashicons dashicons-menu',
421 'permissions' => 'edit_theme_options',
422 'class' => 'quadmenu_theme_' . $key,
423 'fields' => array(
424 array(
425 'customizer' => false,
426 'id' => $key . '_theme_title',
427 'type' => 'text',
428 'title' => esc_html__( 'Theme', 'quadmenu' ),
429 'subtitle' => esc_html__( 'Change theme name.', 'quadmenu' ),
430 'default' => $theme,
431 'validate' => 'no_special_chars',
432 ),
433 array(
434 'customizer' => true,
435 'transport' => 'selective',
436 'class' => $key,
437 'id' => $key . '_layout',
438 'type' => 'image_select',
439 'title' => esc_html__( 'Menu', 'quadmenu' ),
440 'subtitle' => esc_html__( 'Change menu layout.', 'quadmenu' ),
441 'options' => array(
442 'embed' => array(
443 'alt' => esc_html__( 'Embed', 'quadmenu' ),
444 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/embed.png',
445 ),
446 'collapse' => array(
447 'alt' => esc_html__( 'Collapse', 'quadmenu' ),
448 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/collapse.png',
449 ),
450 'offcanvas' => array(
451 'alt' => esc_html__( 'Offcanvas', 'quadmenu' ),
452 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/offcanvas.png',
453 ),
454 'vertical' => array(
455 'alt' => esc_html__( 'Vertical', 'quadmenu' ),
456 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/vertical.png',
457 ),
458 'inherit' => array(
459 'alt' => esc_html__( 'Inherit', 'quadmenu' ),
460 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/inherit.png',
461 ),
462 ),
463 'default' => $this->validate( $this->defaults[ $key . '_layout' ], array( 'embed', 'collapse', 'offcanvas', 'vertical', 'inherit' ) ),
464 ),
465 array(
466 'customizer' => true,
467 'transport' => 'selective',
468 'id' => $key . '_layout_offcanvas_float',
469 'type' => 'image_select',
470 'title' => esc_html__( 'Float', 'quadmenu' ),
471 'subtitle' => esc_html__( 'Vertical menu position.', 'quadmenu' ),
472 'options' => array(
473 'left' => array(
474 'alt' => esc_html__( 'Left', 'quadmenu' ),
475 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/fleft.png',
476 ),
477 'right' => array(
478 'alt' => esc_html__( 'Right', 'quadmenu' ),
479 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/fright.png',
480 ),
481 ),
482 'required' => array(
483 array( $key . '_layout', '=', array( 'offcanvas', 'vertical' ) ),
484 ),
485 'default' => $this->validate( $this->defaults[ $key . '_layout_offcanvas_float' ], array( 'left', 'right' ) ),
486 ),
487 array(
488 'customizer' => true,
489 'transport' => 'selective',
490 'id' => $key . '_layout_align',
491 'type' => 'image_select',
492 'title' => esc_html__( 'Align', 'quadmenu' ),
493 'subtitle' => esc_html__( 'Menu items alignment.', 'quadmenu' ),
494 'options' => array(
495 'left' => array(
496 'alt' => esc_html__( 'Left', 'quadmenu' ),
497 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/aleft.png',
498 ),
499 'center' => array(
500 'alt' => esc_html__( 'Center', 'quadmenu' ),
501 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/acenter.png',
502 ),
503 'right' => array(
504 'alt' => esc_html__( 'Right', 'quadmenu' ),
505 'img' => QUADMENU_PLUGIN_URL . 'assets/backend/img/layouts/aright.png',
506 ),
507 ),
508 'required' => array(
509 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas' ) ),
510 ),
511 'default' => $this->validate( $this->defaults[ $key . '_layout_align' ], array( 'left', 'right' ) ),
512 ),
513 // Behaviour
514 // ---------------------------------------------------------
515 array(
516 'customizer' => true,
517 'transport' => 'postMessage',
518 'id' => $key . '_menu_divider',
519 'type' => 'section',
520 'title' => esc_html__( 'Menu', 'quadmenu' ),
521 'indent' => false,
522 ),
523 array(
524 'customizer' => true,
525 'transport' => 'selective',
526 'id' => $key . '_layout_breakpoint',
527 'type' => 'slider',
528 'title' => esc_html__( 'Breakpoint', 'quadmenu' ),
529 'subtitle' => esc_html__( 'Point at which the navbar becomes uncollapsed.', 'quadmenu' ),
530 'min' => '0',
531 'step' => '1',
532 'max' => '1600',
533 'required' => array(
534 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas', 'vertical' ) ),
535 ),
536 'default' => (int) $this->defaults[ $key . '_layout_breakpoint' ],
537 ),
538 array(
539 'customizer' => true,
540 'transport' => 'selective',
541 'id' => $key . '_layout_width',
542 'type' => 'switch',
543 'title' => esc_html__( 'Width', 'quadmenu' ),
544 'subtitle' => esc_html__( 'Try to force menu width to fit screen.', 'quadmenu' ),
545 'required' => array(
546 array( $key . '_layout', '=', array( 'collapse', 'offcanvas' ) ),
547 ),
548 'default' => (int) $this->defaults[ $key . '_layout_width' ],
549 ),
550 array(
551 'customizer' => true,
552 'transport' => 'selective',
553 'id' => $key . '_layout_width_inner',
554 'type' => 'switch',
555 'title' => esc_html__( 'Inner', 'quadmenu' ),
556 'subtitle' => esc_html__( 'Try to force menu inner width to fit selector.', 'quadmenu' ),
557 'required' => array(
558 array( $key . '_layout', '=', array( 'collapse', 'offcanvas' ) ),
559 ),
560 'default' => (int) $this->defaults[ $key . '_layout_width_inner' ],
561 ),
562 array(
563 'customizer' => true,
564 'transport' => 'selective',
565 'id' => $key . '_layout_width_inner_selector',
566 'type' => 'text',
567 'title' => esc_html__( 'Selector', 'quadmenu' ),
568 'subtitle' => esc_html__( 'The menu container will take the width of this selector.', 'quadmenu' ),
569 'placeholder' => '.container',
570 'default' => $this->defaults[ $key . '_layout_width_inner_selector' ],
571 'required' => array(
572 array( $key . '_layout', '=', array( 'collapse', 'offcanvas' ) ),
573 ),
574 'required' => array(
575 array( $key . '_layout_width_inner', '=', 1 ),
576 ),
577 ),
578 array(
579 'customizer' => true,
580 'transport' => 'selective',
581 'id' => $key . '_layout_lazyload',
582 'type' => 'switch',
583 'title' => esc_html__( 'Lazyload', 'quadmenu' ),
584 'subtitle' => esc_html__( 'Defer images load until they are required.', 'quadmenu' ),
585 'default' => (bool) $this->defaults[ $key . '_layout_lazyload' ],
586 'description' => esc_html__( 'This is a beta function, please test it carefully.', 'quadmenu' ),
587 ),
588 array(
589 'customizer' => true,
590 'transport' => 'selective',
591 'id' => $key . '_layout_current',
592 'type' => 'switch',
593 'title' => esc_html__( 'Open Test', 'quadmenu' ),
594 'subtitle' => esc_html__( 'Open dropdown if is current page.', 'quadmenu' ),
595 'compiler' => false,
596 'default' => (bool) $this->defaults[ $key . '_layout_current' ],
597 ),
598 array(
599 'customizer' => true,
600 'transport' => 'selective',
601 'id' => $key . '_layout_divider',
602 'type' => 'button_set',
603 'title' => esc_html__( 'Divider Test', 'quadmenu' ),
604 'subtitle' => esc_html__( 'Show a small divider bar between each menu item.', 'quadmenu' ),
605 'options' => array(
606 'show' => esc_html__( 'Show', 'quadmenu' ),
607 'hide' => esc_html__( 'Hide', 'quadmenu' ),
608 ),
609 'required' => array(
610 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas' ) ),
611 ),
612 'default' => $this->validate( $this->defaults[ $key . '_layout_divider' ], array( 'show', 'hide' ) ),
613 ),
614 array(
615 'customizer' => true,
616 'transport' => 'selective',
617 'id' => $key . '_layout_caret',
618 'type' => 'button_set',
619 'title' => esc_html__( 'Caret', 'quadmenu' ),
620 'subtitle' => esc_html__( 'Show carets on items with dropdown menus.', 'quadmenu' ),
621 'options' => array(
622 'show' => esc_html__( 'Show', 'quadmenu' ),
623 'hide' => esc_html__( 'Hide', 'quadmenu' ),
624 ),
625 'required' => array(
626 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas' ) ),
627 ),
628 'default' => $this->validate( $this->defaults[ $key . '_layout_caret' ], array( 'show', 'hide' ) ),
629 ),
630 array(
631 'customizer' => false,
632 'id' => $key . '_layout_classes',
633 'type' => 'text',
634 'title' => esc_html__( 'Classes', 'quadmenu' ),
635 'subtitle' => esc_html__( 'Include your own classes in the menu.', 'quadmenu' ),
636 'default' => $this->defaults[ $key . '_layout_classes' ],
637 'validate' => 'no_special_chars',
638 ),
639 // Dropdown
640 // ---------------------------------------------------------
641 array(
642 'id' => $key . '_dropdown_divider',
643 'type' => 'section',
644 'title' => esc_html__( 'Dropdown', 'quadmenu' ),
645 'indent' => false,
646 ),
647 array(
648 'customizer' => true,
649 'transport' => 'selective',
650 'id' => $key . '_layout_trigger',
651 'type' => 'button_set',
652 'title' => esc_html__( 'Trigger', 'quadmenu' ),
653 'options' => array(
654 'hoverintent' => esc_html__( 'Hover', 'quadmenu' ),
655 'click' => esc_html__( 'Click', 'quadmenu' ),
656 ),
657 'subtitle' => esc_html__( 'Open dropdown menu on mouseover or click.', 'quadmenu' ),
658 'default' => $this->validate( $this->defaults[ $key . '_layout_trigger' ], array( 'hoverintent', 'click' ) ),
659 'required' => array(
660 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas' ) ),
661 ),
662 ),
663 array(
664 'customizer' => true,
665 'transport' => 'selective',
666 'id' => $key . '_layout_dropdown_maxheight',
667 'type' => 'switch',
668 'title' => esc_html__( 'Max Height', 'quadmenu' ),
669 'subtitle' => esc_html__( 'Set the max height of dropdowns.', 'quadmenu' ),
670 'compiler' => false,
671 'default' => (bool) $this->defaults[ $key . '_layout_dropdown_maxheight' ],
672 'required' => array(
673 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas' ) ),
674 ),
675 ),
676 ),
677 );
678
679 $sections[] = array(
680 // 'customizer' => true,
681 'subsection' => true,
682 'heading' => false,
683 'icon' => 'dashicons dashicons-desktop',
684 'id' => 'quadmenu_navbar_' . $key,
685 'title' => esc_html__( 'Menu', 'quadmenu' ),
686 'permissions' => 'edit_theme_options',
687 'fields' => array(
688 array(
689 'compiler' => true,
690 'customizer' => true,
691 'transport' => 'selective',
692 'id' => $key . '_navbar_background',
693 'type' => 'button_set',
694 'title' => esc_html__( 'Background', 'quadmenu' ),
695 'subtitle' => esc_html__( 'Select the navbar background.', 'quadmenu' ),
696 'options' => array(
697 'color' => esc_html__( 'Color', 'quadmenu' ),
698 'gradient' => esc_html__( 'Gradient', 'quadmenu' ),
699 ),
700 'default' => $this->validate( $this->defaults[ $key . '_navbar_background' ], array( 'color', 'gradient' ) ),
701 ),
702 array(
703 'compiler' => true,
704 'customizer' => true,
705 'transport' => 'postMessage',
706 'id' => $key . '_navbar_background_color',
707 'title' => esc_html__( 'Color', 'quadmenu' ),
708 'subtitle' => esc_html__( 'Pick a background color for the navbar.', 'quadmenu' ),
709 'type' => 'rgba',
710 'transparent' => false,
711 'validate' => 'colorrgba',
712 // 'options' => array(
713 // 'allow_empty' => false,
714 // ),
715 'default' => $this->defaults[ $key . '_navbar_background_color' ],
716 ),
717 array(
718 'compiler' => true,
719 'customizer' => true,
720 'transport' => 'postMessage',
721 'id' => $key . '_navbar_background_to',
722 'title' => esc_html__( 'Gradient', 'quadmenu' ),
723 'subtitle' => esc_html__( 'Pick a background color for the navbar.', 'quadmenu' ),
724 'type' => 'rgba',
725 'transparent' => false,
726 'required' => array(
727 $key . '_navbar_background',
728 '=',
729 'gradient',
730 ),
731 'validate' => 'colorrgba',
732 // 'options' => array(
733 // 'allow_empty' => false,
734 // ),
735 'default' => $this->defaults[ $key . '_navbar_background_to' ],
736 ),
737 array(
738 'compiler' => true,
739 'customizer' => true,
740 'transport' => 'postMessage',
741 'id' => $key . '_navbar_background_deg',
742 'title' => esc_html__( 'Degrees', 'quadmenu' ),
743 'subtitle' => esc_html__( 'Pick a degrees angle for background gradient.', 'quadmenu' ),
744 'type' => 'spinner',
745 'min' => '0',
746 'step' => '1',
747 'max' => '360',
748 'validate' => 'numeric',
749 'required' => array(
750 $key . '_navbar_background',
751 '=',
752 'gradient',
753 ),
754 'default' => (int) $this->defaults[ $key . '_navbar_background_deg' ],
755 ),
756 array(
757 'compiler' => true,
758 'customizer' => true,
759 'transport' => 'postMessage',
760 'title' => esc_html__( 'Text', 'quadmenu' ),
761 'subtitle' => esc_html__( 'Pick a color for the navbar text.', 'quadmenu' ),
762 'id' => $key . '_navbar_text',
763 'type' => 'color',
764 'transparent' => false,
765 'validate' => 'not_empty',
766 'default' => $this->defaults[ $key . '_navbar_text' ],
767 ),
768 // Navbar
769 // ---------------------------------------------------------
770 array(
771 'customizer' => true,
772 'transport' => 'postMessage',
773 'id' => $key . '_navbar',
774 'type' => 'section',
775 'title' => esc_html__( 'Menu', 'quadmenu' ),
776 'indent' => false,
777 ),
778 array(
779 'compiler' => true,
780 'customizer' => true,
781 'transport' => 'postMessage',
782 'id' => $key . '_navbar_height',
783 'type' => 'slider',
784 'title' => esc_html__( 'Height', 'quadmenu' ),
785 'subtitle' => esc_html__( 'Change the items height.', 'quadmenu' ),
786 'min' => '30',
787 'step' => '2',
788 'max' => '160',
789 'default' => (int) $this->defaults[ $key . '_navbar_height' ],
790 'validate' => 'numeric',
791 ),
792 array(
793 'compiler' => true,
794 'id' => $key . '_navbar_width',
795 'type' => 'slider',
796 'title' => esc_html__( 'Width', 'quadmenu' ),
797 'subtitle' => esc_html__( 'Change the items width.', 'quadmenu' ),
798 'min' => '60',
799 'step' => '1',
800 'max' => '500',
801 'default' => (int) $this->defaults[ $key . '_navbar_width' ],
802 'validate' => 'numeric',
803 ),
804 // Logo
805 // ---------------------------------------------------------
806 array(
807 'customizer' => true,
808 'transport' => 'postMessage',
809 'id' => $key . '_logo',
810 'type' => 'section',
811 'title' => esc_html__( 'Logo', 'quadmenu' ),
812 'indent' => false,
813 // 'required' => array(
814 // array($key . '_layout', '=', array('collapse', 'offcanvas', 'vertical', 'inherit')),
815 // ),
816 ),
817 array(
818 'customizer' => true,
819 'transport' => 'postMessage',
820 'id' => $key . '_navbar_logo_link',
821 'type' => 'text',
822 'title' => esc_html__( 'Link', 'quadmenu' ),
823 'subtitle' => esc_html__( 'Set navbar logo url.', 'quadmenu' ),
824 'default' => $this->defaults[ $key . '_navbar_logo_link' ],
825 'validate' => 'url',
826 // 'required' => array(
827 // array($key . '_layout', '=', array('collapse', 'offcanvas', 'vertical', 'inherit')),
828 // ),
829 ),
830 array(
831 'customizer' => true,
832 'transport' => 'postMessage',
833 'id' => $key . '_navbar_logo',
834 'type' => 'media',
835 'title' => esc_html__( 'Image', 'quadmenu' ),
836 'subtitle' => esc_html__( 'Upload the navbar logo image.', 'quadmenu' ),
837 'default' => $this->defaults[ $key . '_navbar_logo' ],
838 // 'required' => array(
839 // array($key . '_layout', '=', array('collapse', 'offcanvas', 'vertical', 'inherit')),
840 // ),
841 ),
842 array(
843 'compiler' => true,
844 'customizer' => true,
845 'transport' => 'postMessage',
846 'id' => $key . '_navbar_logo_height',
847 'type' => 'slider',
848 'title' => esc_html__( 'Height', 'quadmenu' ),
849 'subtitle' => esc_html__( 'Max logo height in px.', 'quadmenu' ),
850 'min' => '20',
851 'step' => '1',
852 'max' => '160',
853 'default' => (int) $this->defaults[ $key . '_navbar_logo_height' ],
854 'validate' => 'numeric',
855 // 'required' => array(
856 // array($key . '_layout', '=', array('collapse', 'offcanvas', 'vertical', 'inherit')),
857 // ),
858 ),
859 array(
860 'compiler' => true,
861 'customizer' => true,
862 'transport' => 'postMessage',
863 'id' => $key . '_navbar_logo_bg',
864 'title' => esc_html__( 'Background', 'quadmenu' ),
865 'subtitle' => esc_html__( 'Pick a background color for the navbar logo.', 'quadmenu' ),
866 'type' => 'rgba',
867 'transparent' => false,
868 'validate' => 'colorrgba',
869 // 'options' => array(
870 // 'allow_empty' => false,
871 // ),
872 'default' => $this->defaults[ $key . '_navbar_logo_bg' ],
873 // 'required' => array(
874 // array($key . '_layout', '=', array('collapse', 'offcanvas', 'vertical', 'inherit')),
875 // ),
876 ),
877 // Layout
878 // ---------------------------------------------------------
879 array(
880 'customizer' => false,
881 'transport' => 'postMessage',
882 'id' => $key . '_navbar_layout',
883 'type' => 'section',
884 'title' => esc_html__( 'Layout', 'quadmenu' ),
885 'indent' => false,
886 ),
887 array(
888 'compiler' => true,
889 'customizer' => false,
890 'transport' => 'postMessage',
891 'title' => esc_html__( 'Margin', 'quadmenu' ),
892 'subtitle' => esc_html__( 'Set the margin for the navbar links.', 'quadmenu' ),
893 'id' => $key . '_navbar_link_margin',
894 'type' => 'border',
895 'all' => false,
896 'style' => false,
897 'color' => false,
898 'default' => $this->validate_border( $this->defaults[ $key . '_navbar_link_margin' ] ),
899 ),
900 array(
901 'compiler' => true,
902 'customizer' => false,
903 'transport' => 'postMessage',
904 'title' => esc_html__( 'Radius', 'quadmenu' ),
905 'subtitle' => esc_html__( 'Set the radius for the navbar links.', 'quadmenu' ),
906 'id' => $key . '_navbar_link_radius',
907 'type' => 'border',
908 'all' => false,
909 'style' => false,
910 'color' => false,
911 'default' => $this->defaults[ $key . '_navbar_link_radius' ],
912 ),
913 // Link
914 // ---------------------------------------------------------
915 array(
916 'customizer' => true,
917 'transport' => 'postMessage',
918 'id' => $key . '_link',
919 'type' => 'section',
920 'title' => esc_html__( 'Links', 'quadmenu' ),
921 'indent' => false,
922 ),
923 array(
924 'compiler' => true,
925 'customizer' => true,
926 'transport' => 'postMessage',
927 'title' => esc_html__( 'Color', 'quadmenu' ),
928 'subtitle' => esc_html__( 'Pick a color for the navbar links.', 'quadmenu' ),
929 'id' => $key . '_navbar_link',
930 'type' => 'color',
931 'transparent' => false,
932 // 'validate' => 'color',
933 'validate' => 'not_empty',
934 'default' => $this->defaults[ $key . '_navbar_link' ],
935 ),
936 array(
937 'compiler' => true,
938 'customizer' => true,
939 'transport' => 'postMessage',
940 'title' => esc_html__( 'Background', 'quadmenu' ),
941 'subtitle' => esc_html__( 'Pick a color for the navbar background.', 'quadmenu' ),
942 'id' => $key . '_navbar_link_bg',
943 'type' => 'rgba',
944 'transparent' => false,
945 'validate' => 'colorrgba',
946 // 'options' => array(
947 // 'allow_empty' => false,
948 // ),
949 'default' => $this->defaults[ $key . '_navbar_link_bg' ],
950 ),
951 array(
952 'compiler' => true,
953 'customizer' => true,
954 'transport' => 'postMessage',
955 'title' => esc_html__( 'Hover', 'quadmenu' ),
956 'subtitle' => esc_html__( 'Pick a color for the navbar links on mousehover.', 'quadmenu' ),
957 'id' => $key . '_navbar_link_hover',
958 'type' => 'color',
959 'transparent' => false,
960 // 'validate' => 'color',
961 'validate' => 'not_empty',
962 'default' => $this->defaults[ $key . '_navbar_link_hover' ],
963 ),
964 array(
965 'compiler' => true,
966 'customizer' => true,
967 'transport' => 'postMessage',
968 'title' => esc_html__( 'Background', 'quadmenu' ),
969 'subtitle' => esc_html__( 'Pick a color for the navbar background on mousehover.', 'quadmenu' ),
970 'id' => $key . '_navbar_link_bg_hover',
971 'type' => 'rgba',
972 'transparent' => false,
973 'validate' => 'colorrgba',
974 // 'options' => array(
975 // 'allow_empty' => false,
976 // ),
977 'default' => $this->defaults[ $key . '_navbar_link_bg_hover' ],
978 ),
979 array(
980 'compiler' => true,
981 'customizer' => true,
982 'transport' => 'postMessage',
983 'title' => esc_html__( 'Divider', 'quadmenu' ),
984 'subtitle' => esc_html__( 'Pick a color for the navbar links divider.', 'quadmenu' ),
985 'id' => $key . '_navbar_divider',
986 'type' => 'rgba',
987 'transparent' => false,
988 'validate' => 'colorrgba',
989 // 'options' => array(
990 // 'allow_empty' => false,
991 // ),
992 'default' => $this->defaults[ $key . '_navbar_divider' ],
993 ),
994 array(
995 'compiler' => true,
996 'title' => esc_html__( 'Effect', 'quadmenu' ),
997 'subtitle' => esc_html__( 'Pick a color for the navbar link effect on mousehover.', 'quadmenu' ),
998 'id' => $key . '_navbar_link_hover_effect',
999 'type' => 'rgba',
1000 'transparent' => false,
1001 'validate' => 'colorrgba',
1002 // 'options' => array(
1003 // 'allow_empty' => false,
1004 // ),
1005 'default' => $this->defaults[ $key . '_navbar_link_hover_effect' ],
1006 ),
1007 // Icon
1008 // ---------------------------------------------------------
1009 array(
1010 'customizer' => true,
1011 'transport' => 'postMessage',
1012 'id' => $key . '_icon',
1013 'type' => 'section',
1014 'title' => esc_html__( 'Icon', 'quadmenu' ),
1015 'indent' => false,
1016 ),
1017 array(
1018 'compiler' => true,
1019 'customizer' => true,
1020 'transport' => 'postMessage',
1021 'title' => esc_html__( 'Icon', 'quadmenu' ),
1022 'subtitle' => esc_html__( 'Pick a color for the navbar links icon.', 'quadmenu' ),
1023 'id' => $key . '_navbar_link_icon',
1024 'type' => 'color',
1025 'transparent' => false,
1026 // 'validate' => 'color',
1027 'validate' => 'not_empty',
1028 'default' => $this->defaults[ $key . '_navbar_link_icon' ],
1029 ),
1030 array(
1031 'compiler' => true,
1032 'customizer' => true,
1033 'transport' => 'postMessage',
1034 'title' => esc_html__( 'Hover', 'quadmenu' ),
1035 'subtitle' => esc_html__( 'Pick a color for the navbar links icon on hover.', 'quadmenu' ),
1036 'id' => $key . '_navbar_link_icon_hover',
1037 'type' => 'color',
1038 'transparent' => false,
1039 // 'validate' => 'color',
1040 'validate' => 'not_empty',
1041 'default' => $this->defaults[ $key . '_navbar_link_icon_hover' ],
1042 ),
1043 // Subtitle
1044 // ---------------------------------------------------------
1045 array(
1046 'customizer' => true,
1047 'transport' => 'postMessage',
1048 'id' => $key . '_subtitle',
1049 'type' => 'section',
1050 'title' => esc_html__( 'Subtitle', 'quadmenu' ),
1051 'indent' => false,
1052 ),
1053 array(
1054 'compiler' => true,
1055 'customizer' => true,
1056 'transport' => 'postMessage',
1057 'title' => esc_html__( 'Color', 'quadmenu' ),
1058 'subtitle' => esc_html__( 'Pick a color for the navbar links subtitle.', 'quadmenu' ),
1059 'id' => $key . '_navbar_link_subtitle',
1060 'type' => 'color',
1061 'transparent' => false,
1062 // 'validate' => 'color',
1063 'validate' => 'not_empty',
1064 'default' => $this->defaults[ $key . '_navbar_link_subtitle' ],
1065 ),
1066 array(
1067 'compiler' => true,
1068 'customizer' => true,
1069 'transport' => 'postMessage',
1070 'title' => esc_html__( 'Hover', 'quadmenu' ),
1071 'subtitle' => esc_html__( 'Pick a color for the navbar links subtitle on hover.', 'quadmenu' ),
1072 'id' => $key . '_navbar_link_subtitle_hover',
1073 'type' => 'color',
1074 'transparent' => false,
1075 // 'validate' => 'color',
1076 'validate' => 'not_empty',
1077 'default' => $this->defaults[ $key . '_navbar_link_subtitle_hover' ],
1078 ),
1079 // Badge
1080 // ---------------------------------------------------------
1081 array(
1082 'customizer' => true,
1083 'transport' => 'postMessage',
1084 'id' => $key . '_badge',
1085 'type' => 'section',
1086 'title' => esc_html__( 'Badge', 'quadmenu' ),
1087 'indent' => false,
1088 ),
1089 array(
1090 'compiler' => true,
1091 'customizer' => true,
1092 'transport' => 'postMessage',
1093 'title' => esc_html__( 'Color', 'quadmenu' ),
1094 'subtitle' => esc_html__( 'Pick a color for the badge.', 'quadmenu' ),
1095 'id' => $key . '_navbar_badge_color',
1096 'type' => 'color',
1097 'transparent' => false,
1098 // 'validate' => 'color',
1099 'validate' => 'not_empty',
1100 'default' => $this->defaults[ $key . '_navbar_badge_color' ],
1101 ),
1102 array(
1103 'compiler' => true,
1104 'customizer' => true,
1105 'transport' => 'postMessage',
1106 'title' => esc_html__( 'Background', 'quadmenu' ),
1107 'subtitle' => esc_html__( 'Pick a background color for the badge.', 'quadmenu' ),
1108 'id' => $key . '_navbar_badge',
1109 'type' => 'color',
1110 'transparent' => false,
1111 // 'validate' => 'color',
1112 'validate' => 'not_empty',
1113 'default' => $this->defaults[ $key . '_navbar_badge' ],
1114 ),
1115 // Button
1116 // ---------------------------------------------------------
1117 array(
1118 'id' => $key . '_button',
1119 'type' => 'section',
1120 'title' => esc_html__( 'Button', 'quadmenu' ),
1121 'indent' => false,
1122 ),
1123 array(
1124 'title' => esc_html__( 'Color', 'quadmenu' ),
1125 'subtitle' => esc_html__( 'Pick a color for the navbar button.', 'quadmenu' ),
1126 'id' => $key . '_navbar_button',
1127 'type' => 'color',
1128 'transparent' => false,
1129 // 'validate' => 'color',
1130 'validate' => 'not_empty',
1131 'compiler' => true,
1132 'default' => $this->defaults[ $key . '_navbar_button' ],
1133 ),
1134 array(
1135 'title' => esc_html__( 'Background', 'quadmenu' ),
1136 'subtitle' => esc_html__( 'Pick a color for the navbar button.', 'quadmenu' ),
1137 'id' => $key . '_navbar_button_background',
1138 'type' => 'color',
1139 'transparent' => false,
1140 // 'validate' => 'color',
1141 'validate' => 'not_empty',
1142 'compiler' => true,
1143 'default' => $this->defaults[ $key . '_navbar_button_background' ],
1144 ),
1145 array(
1146 'title' => esc_html__( 'Hover', 'quadmenu' ),
1147 'subtitle' => esc_html__( 'Pick a color for the navbar button on mousehover.', 'quadmenu' ),
1148 'id' => $key . '_navbar_button_hover',
1149 'type' => 'color',
1150 'transparent' => false,
1151 // 'validate' => 'color',
1152 'validate' => 'not_empty',
1153 'compiler' => true,
1154 'default' => $this->defaults[ $key . '_navbar_button_hover' ],
1155 ),
1156 array(
1157 'title' => esc_html__( 'Background', 'quadmenu' ),
1158 'subtitle' => esc_html__( 'Pick a color for the navbar button on mousehover.', 'quadmenu' ),
1159 'id' => $key . '_navbar_button_hover_background',
1160 'type' => 'color',
1161 'transparent' => false,
1162 // 'validate' => 'color',
1163 'validate' => 'not_empty',
1164 'compiler' => true,
1165 'default' => $this->defaults[ $key . '_navbar_button_hover_background' ],
1166 ),
1167 array(
1168 'compiler' => true,
1169 'customizer' => true,
1170 'transport' => 'postMessage',
1171 'title' => esc_html__( 'Radius', 'quadmenu' ),
1172 'subtitle' => esc_html__( 'Button border radius.', 'quadmenu' ),
1173 'id' => $key . '_navbar_button_radius',
1174 'type' => 'border',
1175 'all' => false,
1176 'style' => false,
1177 'color' => false,
1178 'default' => $this->validate_border( $this->defaults[ $key . '_navbar_button_radius' ] ),
1179 ),
1180 // Scrollbar
1181 // ---------------------------------------------------------
1182 array(
1183 'customizer' => false,
1184 'id' => $key . '_scrollbar',
1185 'type' => 'section',
1186 'title' => esc_html__( 'ScrollBar', 'quadmenu' ),
1187 'indent' => false,
1188 'required' => array(
1189 'styles_pscrollbar',
1190 '=',
1191 true,
1192 ),
1193 ),
1194 array(
1195 'compiler' => true,
1196 'customizer' => false,
1197 'title' => esc_html__( 'Scroll', 'quadmenu' ),
1198 'subtitle' => esc_html__( 'Pick a color for the scrollbar.', 'quadmenu' ),
1199 'id' => $key . '_navbar_scrollbar',
1200 'type' => 'rgba',
1201 'transparent' => false,
1202 'validate' => 'colorrgba',
1203 'default' => $this->defaults[ $key . '_navbar_scrollbar' ],
1204 ),
1205 array(
1206 'compiler' => true,
1207 'customizer' => false,
1208 'title' => esc_html__( 'Background', 'quadmenu' ),
1209 'subtitle' => esc_html__( 'Pick a color for the scrollbar rail.', 'quadmenu' ),
1210 'id' => $key . '_navbar_scrollbar_rail',
1211 'type' => 'rgba',
1212 'transparent' => false,
1213 'validate' => 'colorrgba',
1214 'default' => $this->defaults[ $key . '_navbar_scrollbar_rail' ],
1215 ),
1216 ),
1217 );
1218
1219 $sections[] = array(
1220 // 'customizer' => true,
1221 'subsection' => true,
1222 'heading' => false,
1223 'icon' => 'dashicons dashicons-sticky',
1224 'id' => 'quadmenu_sticky_' . $key,
1225 'title' => esc_html__( 'Sticky', 'quadmenu' ),
1226 'permissions' => 'edit_theme_options',
1227 'fields' => array(
1228 // Sticky
1229 // ---------------------------------------------------------
1230 array(
1231 'customizer' => true,
1232 'transport' => 'selective',
1233 'id' => $key . '_layout_sticky',
1234 'type' => 'switch',
1235 'title' => esc_html__( 'Sticky', 'quadmenu' ),
1236 'subtitle' => esc_html__( 'Make the menu sticky on scroll.', 'quadmenu' ),
1237 'default' => (int) $this->defaults[ $key . '_layout_sticky' ],
1238 ),
1239 array(
1240 'customizer' => true,
1241 'transport' => 'selective',
1242 'id' => $key . '_layout_sticky_offset',
1243 'type' => 'slider',
1244 'title' => esc_html__( 'Offset', 'quadmenu' ),
1245 'subtitle' => esc_html__( 'Set the length of the scroll for each user to pass before the menu will stick to the top of the window.', 'quadmenu' ),
1246 'min' => '0',
1247 'step' => '1',
1248 'max' => '340',
1249 'required' => array(
1250 $key . '_layout_sticky',
1251 '=',
1252 1,
1253 ),
1254 'default' => (int) $this->defaults[ $key . '_layout_sticky_offset' ],
1255 ),
1256 array(
1257 'compiler' => true,
1258 'customizer' => true,
1259 'transport' => 'postMessage',
1260 'id' => $key . '_sticky_background',
1261 'title' => esc_html__( 'Background', 'quadmenu' ),
1262 'subtitle' => esc_html__( 'Change the navbar sticky background.', 'quadmenu' ),
1263 'type' => 'rgba',
1264 'validate' => 'colorrgba',
1265 // 'options' => array(
1266 // 'allow_empty' => false,
1267 // ),
1268 'transparent' => false,
1269 'default' => $this->defaults[ $key . '_sticky_background' ],
1270 ),
1271 array(
1272 'compiler' => true,
1273 'customizer' => true,
1274 'transport' => 'postMessage',
1275 'id' => $key . '_sticky_height',
1276 'type' => 'slider',
1277 'title' => esc_html__( 'Height', 'quadmenu' ),
1278 'subtitle' => esc_html__( 'Change the navbar sticky height.', 'quadmenu' ),
1279 'min' => '30',
1280 'step' => '2',
1281 'max' => '160',
1282 'default' => $this->defaults[ $key . '_sticky_height' ],
1283 ),
1284 array(
1285 'compiler' => true,
1286 'customizer' => true,
1287 'transport' => 'postMessage',
1288 'id' => $key . '_sticky_logo_height',
1289 'type' => 'slider',
1290 'title' => esc_html__( 'Logo', 'quadmenu' ),
1291 'subtitle' => esc_html__( 'Max logo height in px.', 'quadmenu' ),
1292 'min' => '20',
1293 'step' => '1',
1294 'max' => '160',
1295 'default' => $this->defaults[ $key . '_sticky_logo_height' ],
1296 ),
1297 ),
1298 );
1299
1300 $sections[] = array(
1301 // 'customizer' => true,
1302 'subsection' => true,
1303 'heading' => false,
1304 'icon' => 'dashicons dashicons-tablet',
1305 'id' => 'quadmenu_mobile_' . $key,
1306 'title' => esc_html__( 'Mobile', 'quadmenu' ),
1307 'permissions' => 'edit_theme_options',
1308 'fields' => array(
1309 // Mobile
1310 // ---------------------------------------------------------
1311 /*
1312 array(
1313 'id' => $key . '_mobile',
1314 'type' => 'section',
1315 'title' => esc_html__('Mobile', 'quadmenu'),
1316 'indent' => true
1317 ), */
1318 array(
1319 'customizer' => true,
1320 'transport' => 'selective',
1321 'id' => $key . '_mobile_shadow',
1322 'type' => 'button_set',
1323 'title' => esc_html__( 'Shadow', 'quadmenu' ),
1324 'subtitle' => esc_html__( 'Display shadow on mobile navbar.', 'quadmenu' ),
1325 'options' => array(
1326 'show' => esc_html__( 'Show', 'quadmenu' ),
1327 'hide' => esc_html__( 'Hide', 'quadmenu' ),
1328 ),
1329 'default' => $this->validate( $this->defaults[ $key . '_mobile_shadow' ], array( 'show', 'hide' ) ),
1330 ),
1331 array(
1332 'compiler' => true,
1333 'title' => esc_html__( 'Border', 'quadmenu' ),
1334 'subtitle' => esc_html__( 'Pick a color for the border separator.', 'quadmenu' ),
1335 'id' => $key . '_navbar_mobile_border',
1336 'type' => 'rgba',
1337 'transparent' => false,
1338 'validate' => 'colorrgba',
1339 'default' => $this->defaults[ $key . '_navbar_mobile_border' ],
1340 ),
1341 // Toggle
1342 // ---------------------------------------------------------
1343 array(
1344 'customizer' => true,
1345 'transport' => 'postMessage',
1346 'id' => $key . '_toggle',
1347 'type' => 'section',
1348 'title' => esc_html__( 'Toggle', 'quadmenu' ),
1349 'indent' => false,
1350 ),
1351 array(
1352 'compiler' => true,
1353 'customizer' => true,
1354 'transport' => 'postMessage',
1355 'title' => esc_html__( 'Open', 'quadmenu' ),
1356 'subtitle' => esc_html__( 'Pick a color for the toggle icon.', 'quadmenu' ),
1357 'id' => $key . '_navbar_toggle_open',
1358 'type' => 'color',
1359 'transparent' => false,
1360 'validate' => 'not_empty',
1361 'default' => $this->defaults[ $key . '_navbar_toggle_open' ],
1362 ),
1363 array(
1364 'compiler' => true,
1365 'customizer' => true,
1366 'transport' => 'postMessage',
1367 'title' => esc_html__( 'Close', 'quadmenu' ),
1368 'subtitle' => esc_html__( 'Pick a color for the toggle button background on hover.', 'quadmenu' ),
1369 'id' => $key . '_navbar_toggle_close',
1370 'type' => 'color',
1371 'transparent' => false,
1372 'validate' => 'not_empty',
1373 'default' => $this->defaults[ $key . '_navbar_toggle_close' ],
1374 ),
1375 array(
1376 'customizer' => true,
1377 'transport' => 'postMessage',
1378 'id' => $key . '_mobile_link',
1379 'type' => 'section',
1380 'title' => esc_html__( 'Link', 'quadmenu' ),
1381 'indent' => false,
1382 ),
1383 array(
1384 'compiler' => true,
1385 'customizer' => false,
1386 'transport' => 'postMessage',
1387 'title' => esc_html__( 'Margin', 'quadmenu' ),
1388 'subtitle' => esc_html__( 'Set the margin for the mobile links.', 'quadmenu' ),
1389 'id' => $key . '_mobile_link_padding',
1390 'type' => 'border',
1391 'all' => false,
1392 'style' => false,
1393 'color' => false,
1394 'default' => $this->defaults[ $key . '_mobile_link_padding' ],
1395 ),
1396 array(
1397 'compiler' => true,
1398 'customizer' => true,
1399 'transport' => 'postMessage',
1400 'title' => esc_html__( 'Border', 'quadmenu' ),
1401 'subtitle' => esc_html__( 'Pick a border color for the mobile menu links border.', 'quadmenu' ),
1402 'id' => $key . '_mobile_link_border',
1403 'type' => 'border',
1404 'default' => $this->defaults[ $key . '_mobile_link_border' ],
1405 ),
1406 ),
1407 );
1408
1409 $sections[] = array(
1410 // 'customizer' => true,
1411 'subsection' => true,
1412 'heading' => false,
1413 'icon' => 'dashicons dashicons-editor-break',
1414 'id' => 'quadmenu_dropdown_' . $key,
1415 'title' => esc_html__( 'Dropdown', 'quadmenu' ),
1416 'permissions' => 'edit_theme_options',
1417 'fields' => array(
1418 array(
1419 'customizer' => true,
1420 'transport' => 'selective',
1421 'id' => $key . '_dropdown_shadow',
1422 'type' => 'button_set',
1423 'title' => esc_html__( 'Shadow', 'quadmenu' ),
1424 'subtitle' => esc_html__( 'Display shadow on dropdown menus.', 'quadmenu' ),
1425 'options' => array(
1426 'show' => esc_html__( 'Show', 'quadmenu' ),
1427 'hide' => esc_html__( 'Hide', 'quadmenu' ),
1428 ),
1429 'default' => $this->validate( $this->defaults[ $key . '_dropdown_shadow' ], array( 'show', 'hide' ) ),
1430 ),
1431 array(
1432 'compiler' => true,
1433 'customizer' => true,
1434 'transport' => 'postMessage',
1435 'id' => $key . '_dropdown_margin',
1436 'type' => 'spinner',
1437 'title' => esc_html__( 'Margin', 'quadmenu' ),
1438 'subtitle' => esc_html__( 'Dropdown margin top.', 'quadmenu' ),
1439 'min' => '0',
1440 'step' => '1',
1441 'max' => '45',
1442 'default' => (int) $this->defaults[ $key . '_dropdown_margin' ],
1443 ),
1444 array(
1445 'compiler' => true,
1446 'customizer' => true,
1447 'transport' => 'postMessage',
1448 'title' => esc_html__( 'Radius', 'quadmenu' ),
1449 'subtitle' => esc_html__( 'Dropdown border radius.', 'quadmenu' ),
1450 'id' => $key . '_dropdown_radius',
1451 'type' => 'border',
1452 'all' => false,
1453 'style' => false,
1454 'color' => false,
1455 'default' => $this->validate_border( $this->defaults[ $key . '_dropdown_radius' ] ),
1456 ),
1457 array(
1458 'compiler' => true,
1459 'customizer' => true,
1460 'transport' => 'postMessage',
1461 'title' => esc_html__( 'Border', 'quadmenu' ),
1462 'subtitle' => esc_html__( 'Pick a border color for the dropdown.', 'quadmenu' ),
1463 'id' => $key . '_dropdown_border',
1464 'type' => 'border',
1465 'all' => false,
1466 'style' => false,
1467 'default' => $this->validate_border( $this->defaults[ $key . '_dropdown_border' ] ),
1468 ),
1469 array(
1470 'compiler' => true,
1471 'customizer' => true,
1472 'transport' => 'postMessage',
1473 'title' => esc_html__( 'Background', 'quadmenu' ),
1474 'subtitle' => esc_html__( 'Pick a background color for the dropdown menu.', 'quadmenu' ),
1475 'id' => $key . '_dropdown_background',
1476 'type' => 'rgba',
1477 'transparent' => false,
1478 'validate' => 'colorrgba',
1479 // 'options' => array(
1480 // 'allow_empty' => false,
1481 // ),
1482 'default' => $this->defaults[ $key . '_dropdown_background' ],
1483 ),
1484 // Link
1485 // ---------------------------------------------------------
1486 array(
1487 'customizer' => true,
1488 'transport' => 'postMessage',
1489 'id' => $key . '_dropdown_link_section',
1490 'type' => 'section',
1491 'title' => esc_html__( 'Link', 'quadmenu' ),
1492 'indent' => false,
1493 ),
1494 array(
1495 'compiler' => true,
1496 'customizer' => true,
1497 'transport' => 'postMessage',
1498 'title' => esc_html__( 'Color', 'quadmenu' ),
1499 'subtitle' => esc_html__( 'Pick a color for the dropdown menu links.', 'quadmenu' ),
1500 'id' => $key . '_dropdown_link',
1501 'type' => 'color',
1502 'transparent' => false,
1503 // 'validate' => 'color',
1504 'validate' => 'not_empty',
1505 'default' => $this->defaults[ $key . '_dropdown_link' ],
1506 ),
1507 array(
1508 'compiler' => true,
1509 'customizer' => true,
1510 'transport' => 'postMessage',
1511 'title' => esc_html__( 'Hover', 'quadmenu' ),
1512 'subtitle' => esc_html__( 'Pick a color for the dropdown menu links on mousehover.', 'quadmenu' ),
1513 'id' => $key . '_dropdown_link_hover',
1514 'type' => 'color',
1515 'transparent' => false,
1516 // 'validate' => 'color',
1517 'validate' => 'not_empty',
1518 'default' => $this->defaults[ $key . '_dropdown_link_hover' ],
1519 ),
1520 array(
1521 'compiler' => true,
1522 'customizer' => true,
1523 'transport' => 'postMessage',
1524 'title' => esc_html__( 'Background', 'quadmenu' ),
1525 'subtitle' => esc_html__( 'Pick a background color for the links on mouseover.', 'quadmenu' ),
1526 'id' => $key . '_dropdown_link_bg_hover',
1527 'type' => 'rgba',
1528 'transparent' => false,
1529 'validate' => 'colorrgba',
1530 // 'options' => array(
1531 // 'allow_empty' => false,
1532 // ),
1533 'default' => $this->defaults[ $key . '_dropdown_link_bg_hover' ],
1534 ),
1535 /*
1536 array(
1537 'compiler' => true,
1538 'customizer' => false,
1539 'transport' => 'postMessage',
1540 'title' => esc_html__('Margin', 'quadmenu'),
1541 'subtitle' => esc_html__('Set the margin for the navbar links.', 'quadmenu'),
1542 'id' => $key . '_dropdown_link_padding',
1543 'type' => 'border',
1544 'all' => false,
1545 'style' => false,
1546 'color' => false,
1547 'default' => $this->defaults[$key . '_dropdown_link_padding']
1548 ), */
1549 array(
1550 'compiler' => true,
1551 'customizer' => true,
1552 'transport' => 'postMessage',
1553 'title' => esc_html__( 'Border', 'quadmenu' ),
1554 'subtitle' => esc_html__( 'Pick a border color for the dropdown menu links border.', 'quadmenu' ),
1555 'id' => $key . '_dropdown_link_border',
1556 'type' => 'border',
1557 'default' => $this->defaults[ $key . '_dropdown_link_border' ],
1558 ),
1559 // Title
1560 // ---------------------------------------------------------
1561 array(
1562 'customizer' => true,
1563 'transport' => 'postMessage',
1564 'id' => $key . '_title',
1565 'type' => 'section',
1566 'title' => esc_html__( 'Title', 'quadmenu' ),
1567 'indent' => false,
1568 ),
1569 array(
1570 'compiler' => true,
1571 'customizer' => true,
1572 'transport' => 'postMessage',
1573 'title' => esc_html__( 'Title', 'quadmenu' ),
1574 'subtitle' => esc_html__( 'Pick a color for the dropdown menu title.', 'quadmenu' ),
1575 'id' => $key . '_dropdown_title',
1576 'type' => 'color',
1577 'transparent' => false,
1578 // 'validate' => 'color',
1579 'validate' => 'not_empty',
1580 'default' => $this->defaults[ $key . '_dropdown_title' ],
1581 ),
1582 array(
1583 'compiler' => true,
1584 'customizer' => true,
1585 'transport' => 'postMessage',
1586 'title' => esc_html__( 'Border', 'quadmenu' ),
1587 'subtitle' => esc_html__( 'Pick a color for the dropdown menu title border.', 'quadmenu' ),
1588 'id' => $key . '_dropdown_title_border',
1589 'type' => 'border',
1590 'default' => $this->defaults[ $key . '_dropdown_title_border' ],
1591 ),
1592 // Icon
1593 // ---------------------------------------------------------
1594 array(
1595 'customizer' => true,
1596 'transport' => 'postMessage',
1597 'id' => $key . '_icon',
1598 'type' => 'section',
1599 'title' => esc_html__( 'Icon', 'quadmenu' ),
1600 'indent' => false,
1601 ),
1602 array(
1603 'compiler' => true,
1604 'customizer' => true,
1605 'transport' => 'postMessage',
1606 'title' => esc_html__( 'Icon', 'quadmenu' ),
1607 'icon' => esc_html__( 'Pick a color for the dropdown links icon.', 'quadmenu' ),
1608 'id' => $key . '_dropdown_link_icon',
1609 'type' => 'color',
1610 'transparent' => false,
1611 // 'validate' => 'color',
1612 'validate' => 'not_empty',
1613 'default' => $this->defaults[ $key . '_dropdown_link_icon' ],
1614 ),
1615 array(
1616 'compiler' => true,
1617 'customizer' => true,
1618 'transport' => 'postMessage',
1619 'title' => esc_html__( 'Hover', 'quadmenu' ),
1620 'icon' => esc_html__( 'Pick a color for the dropdown links icon on hover.', 'quadmenu' ),
1621 'id' => $key . '_dropdown_link_icon_hover',
1622 'type' => 'color',
1623 'transparent' => false,
1624 // 'validate' => 'color',
1625 'validate' => 'not_empty',
1626 'default' => $this->defaults[ $key . '_dropdown_link_icon_hover' ],
1627 ),
1628 // Subtitle
1629 // ---------------------------------------------------------
1630 array(
1631 'customizer' => true,
1632 'transport' => 'postMessage',
1633 'id' => $key . '_subtitle',
1634 'type' => 'section',
1635 'title' => esc_html__( 'Subtitle', 'quadmenu' ),
1636 'indent' => false,
1637 ),
1638 array(
1639 'compiler' => true,
1640 'customizer' => true,
1641 'transport' => 'postMessage',
1642 'title' => esc_html__( 'Color', 'quadmenu' ),
1643 'subtitle' => esc_html__( 'Pick a color for the dropdown links subtitle.', 'quadmenu' ),
1644 'id' => $key . '_dropdown_link_subtitle',
1645 'type' => 'color',
1646 'transparent' => false,
1647 // 'validate' => 'color',
1648 'validate' => 'not_empty',
1649 'default' => $this->defaults[ $key . '_dropdown_link_subtitle' ],
1650 ),
1651 array(
1652 'compiler' => true,
1653 'customizer' => true,
1654 'transport' => 'postMessage',
1655 'title' => esc_html__( 'Hover', 'quadmenu' ),
1656 'subtitle' => esc_html__( 'Pick a color for the dropdown links subtitle on hover.', 'quadmenu' ),
1657 'id' => $key . '_dropdown_link_subtitle_hover',
1658 'type' => 'color',
1659 'transparent' => false,
1660 // 'validate' => 'color',
1661 'validate' => 'not_empty',
1662 'default' => $this->defaults[ $key . '_dropdown_link_subtitle_hover' ],
1663 ),
1664 // Button
1665 // ---------------------------------------------------------
1666 array(
1667 'customizer' => true,
1668 'transport' => 'postMessage',
1669 'id' => $key . '_button',
1670 'type' => 'section',
1671 'title' => esc_html__( 'Button', 'quadmenu' ),
1672 'indent' => false,
1673 ),
1674 array(
1675 'compiler' => true,
1676 'customizer' => true,
1677 'transport' => 'postMessage',
1678 'title' => esc_html__( 'Color', 'quadmenu' ),
1679 'subtitle' => esc_html__( 'Pick a color for the navbar button.', 'quadmenu' ),
1680 'id' => $key . '_dropdown_button',
1681 'type' => 'color',
1682 'transparent' => false,
1683 // 'validate' => 'color',
1684 'validate' => 'not_empty',
1685 'default' => $this->defaults[ $key . '_dropdown_button' ],
1686 ),
1687 array(
1688 'compiler' => true,
1689 'customizer' => true,
1690 'transport' => 'postMessage',
1691 'title' => esc_html__( 'Background', 'quadmenu' ),
1692 'subtitle' => esc_html__( 'Pick a color for the navbar button.', 'quadmenu' ),
1693 'id' => $key . '_dropdown_button_bg',
1694 'type' => 'color',
1695 'transparent' => false,
1696 // 'validate' => 'color',
1697 'validate' => 'not_empty',
1698 'default' => $this->defaults[ $key . '_dropdown_button_bg' ],
1699 ),
1700 array(
1701 'compiler' => true,
1702 'customizer' => true,
1703 'transport' => 'postMessage',
1704 'title' => esc_html__( 'Hover', 'quadmenu' ),
1705 'subtitle' => esc_html__( 'Pick a color for the navbar button on hover.', 'quadmenu' ),
1706 'id' => $key . '_dropdown_button_hover',
1707 'type' => 'color',
1708 'transparent' => false,
1709 // 'validate' => 'color',
1710 'validate' => 'not_empty',
1711 'default' => $this->defaults[ $key . '_dropdown_button_hover' ],
1712 ),
1713 array(
1714 'compiler' => true,
1715 'customizer' => true,
1716 'transport' => 'postMessage',
1717 'title' => esc_html__( 'Background', 'quadmenu' ),
1718 'subtitle' => esc_html__( 'Pick a color for the navbar button on hover.', 'quadmenu' ),
1719 'id' => $key . '_dropdown_button_bg_hover',
1720 'type' => 'color',
1721 'transparent' => false,
1722 // 'validate' => 'color',
1723 'validate' => 'not_empty',
1724 'default' => $this->defaults[ $key . '_dropdown_button_bg_hover' ],
1725 ),
1726 /*
1727 array(
1728 'compiler' => true,
1729 'customizer' => true,
1730 'transport' => 'postMessage',
1731 'title' => esc_html__('Radius', 'quadmenu'),
1732 'subtitle' => esc_html__('Dropdown button border radius.', 'quadmenu'),
1733 'id' => $key . '_dropdown_button_radius',
1734 'type' => 'border',
1735 'all' => false,
1736 'style' => false,
1737 'color' => false,
1738 'default' => $this->validate_border($this->defaults[$key . '_dropdown_button_radius'])
1739 ),
1740 */
1741 // Tab
1742 // ---------------------------------------------------------
1743 array(
1744 'customizer' => true,
1745 'transport' => 'postMessage',
1746 'id' => $key . '_tab',
1747 'type' => 'section',
1748 'title' => esc_html__( 'Tab', 'quadmenu' ),
1749 'indent' => false,
1750 ),
1751 array(
1752 'compiler' => true,
1753 'customizer' => true,
1754 'transport' => 'postMessage',
1755 'title' => esc_html__( 'Background', 'quadmenu' ),
1756 'subtitle' => esc_html__( 'Pick a color for the navbar tab.', 'quadmenu' ),
1757 'id' => $key . '_dropdown_tab_bg',
1758 'type' => 'rgba',
1759 'transparent' => false,
1760 'validate' => 'colorrgba',
1761 'transparent' => false,
1762 'default' => $this->defaults[ $key . '_dropdown_tab_bg' ],
1763 ),
1764 array(
1765 'compiler' => true,
1766 'customizer' => true,
1767 'transport' => 'postMessage',
1768 'title' => esc_html__( 'Hover', 'quadmenu' ),
1769 'subtitle' => esc_html__( 'Pick a color for the navbar tab on hover.', 'quadmenu' ),
1770 'id' => $key . '_dropdown_tab_bg_hover',
1771 'type' => 'rgba',
1772 'transparent' => false,
1773 'validate' => 'colorrgba',
1774 'transparent' => false,
1775 'default' => $this->defaults[ $key . '_dropdown_tab_bg_hover' ],
1776 ),
1777 // Scrollbar
1778 // ---------------------------------------------------------
1779 array(
1780 'customizer' => false,
1781 'id' => $key . '_dropdown_scrollbar_section',
1782 'type' => 'section',
1783 'title' => esc_html__( 'ScrollBar', 'quadmenu' ),
1784 'indent' => false,
1785 'required' => array(
1786 'styles_pscrollbar',
1787 '=',
1788 true,
1789 ),
1790 ),
1791 array(
1792 'compiler' => true,
1793 'customizer' => false,
1794 'title' => esc_html__( 'Scroll', 'quadmenu' ),
1795 'subtitle' => esc_html__( 'Pick a color for the scrollbar.', 'quadmenu' ),
1796 'id' => $key . '_dropdown_scrollbar',
1797 'type' => 'rgba',
1798 'transparent' => false,
1799 'validate' => 'colorrgba',
1800 'default' => $this->defaults[ $key . '_dropdown_scrollbar' ],
1801 ),
1802 array(
1803 'compiler' => true,
1804 'customizer' => false,
1805 'title' => esc_html__( 'Background', 'quadmenu' ),
1806 'subtitle' => esc_html__( 'Pick a color for the scrollbar rail.', 'quadmenu' ),
1807 'id' => $key . '_dropdown_scrollbar_rail',
1808 'type' => 'rgba',
1809 'transparent' => false,
1810 'validate' => 'colorrgba',
1811 'default' => $this->defaults[ $key . '_dropdown_scrollbar_rail' ],
1812 ),
1813 ),
1814 );
1815
1816 $sections[] = array(
1817 'subsection' => true,
1818 'heading' => false,
1819 'icon' => 'dashicons dashicons-editor-paste-text',
1820 'id' => 'quadmenu_typography_' . $key,
1821 'title' => esc_html__( 'Typography', 'quadmenu' ),
1822 'permissions' => 'edit_theme_options',
1823 'fields' => array(
1824 array(
1825 'compiler' => true,
1826 'id' => $key . '_font',
1827 'type' => 'typography',
1828 'title' => esc_html__( 'General', 'quadmenu' ),
1829 'subtitle' => esc_html__( 'Specify the font properties.', 'quadmenu' ),
1830 'font-weight' => true,
1831 'font-size' => true,
1832 'font-style' => true,
1833 'letter-spacing' => true,
1834 'line-height' => false,
1835 'google' => true,
1836 'text-align' => false,
1837 'color' => false,
1838 'subsets' => true,
1839 'default' => $this->validate_font( $this->defaults[ $key . '_font' ] ),
1840 ),
1841 array(
1842 'compiler' => true,
1843 'id' => $key . '_navbar_font',
1844 'type' => 'typography',
1845 'title' => esc_html__( 'Menu', 'quadmenu' ),
1846 'subtitle' => esc_html__( 'Specify the font properties.', 'quadmenu' ),
1847 'font-weight' => true,
1848 'font-size' => true,
1849 'font-style' => true,
1850 'line-height' => false,
1851 'letter-spacing' => true,
1852 'google' => true,
1853 'text-align' => false,
1854 'color' => false,
1855 'subsets' => true,
1856 'default' => $this->validate_font( $this->defaults[ $key . '_navbar_font' ] ),
1857 ),
1858 array(
1859 'compiler' => true,
1860 'customizer' => true,
1861 'transport' => 'postMessage',
1862 'title' => esc_html__( 'Transform', 'quadmenu' ),
1863 'subtitle' => esc_html__( 'Pick a text transform for the link.', 'quadmenu' ),
1864 'id' => $key . '_navbar_link_transform',
1865 'type' => 'select',
1866 'options' => array(
1867 'none' => esc_html__( 'None', 'quadmenu' ),
1868 'capitalize' => esc_html__( 'Capitalize', 'quadmenu' ),
1869 'uppercase' => esc_html__( 'Uppercase', 'quadmenu' ),
1870 'lowercase' => esc_html__( 'Lowercase', 'quadmenu' ),
1871 ),
1872 'default' => $this->defaults[ $key . '_navbar_link_transform' ],
1873 ),
1874 array(
1875 'compiler' => true,
1876 'id' => $key . '_dropdown_font',
1877 'type' => 'typography',
1878 'title' => esc_html__( 'Submenu', 'quadmenu' ),
1879 'subtitle' => esc_html__( 'Specify the font properties.', 'quadmenu' ),
1880 'font-weight' => true,
1881 'font-size' => true,
1882 'font-style' => true,
1883 'line-height' => false,
1884 'letter-spacing' => true,
1885 'google' => true,
1886 'text-align' => false,
1887 'color' => false,
1888 'subsets' => true,
1889 'default' => $this->validate_font( $this->defaults[ $key . '_dropdown_font' ] ),
1890 ),
1891 array(
1892 'compiler' => true,
1893 'customizer' => true,
1894 'transport' => 'postMessage',
1895 'title' => esc_html__( 'Transform', 'quadmenu' ),
1896 'subtitle' => esc_html__( 'Pick a text transform for the link.', 'quadmenu' ),
1897 'id' => $key . '_dropdown_link_transform',
1898 'type' => 'select',
1899 'options' => array(
1900 'none' => esc_html__( 'None', 'quadmenu' ),
1901 'capitalize' => esc_html__( 'Capitalize', 'quadmenu' ),
1902 'uppercase' => esc_html__( 'Uppercase', 'quadmenu' ),
1903 'lowercase' => esc_html__( 'Lowercase', 'quadmenu' ),
1904 ),
1905 'default' => $this->defaults[ $key . '_dropdown_link_transform' ],
1906 ),
1907 ),
1908 );
1909
1910 $sections[] = array(
1911 'subsection' => true,
1912 'heading' => false,
1913 'icon' => 'dashicons dashicons-format-video',
1914 'id' => 'quadmenu_animations_' . $key,
1915 'title' => esc_html__( 'Animations', 'quadmenu' ),
1916 'permissions' => 'edit_theme_options',
1917 'fields' => array(
1918 array(
1919 'customizer' => true,
1920 'transport' => 'selective',
1921 'id' => $key . '_layout_hover_effect',
1922 'type' => 'select',
1923 'title' => esc_html__( 'Effect', 'quadmenu' ),
1924 'subtitle' => esc_html__( 'Add an amazing effect for the hover event.', 'quadmenu' ),
1925 'options' => array(
1926 'quadmenu-hover-ripple' => esc_html__( 'Ripple', 'quadmenu' ),
1927 // 'quadmenu-hover-text-top' => esc_html__('Text Top', 'quadmenu'),
1928 'quadmenu-hover-slidebar sl-top' => esc_html__( 'SlideBar Top (Horizontal)', 'quadmenu' ),
1929 'quadmenu-hover-slidebar sl-middle' => esc_html__( 'SlideBar Middle (Horizontal)', 'quadmenu' ),
1930 'quadmenu-hover-slidebar sl-bottom' => esc_html__( 'SlideBar Bottom (Horizontal)', 'quadmenu' ),
1931 ),
1932 'required' => array(
1933 array( $key . '_layout', '=', array( 'collapse', 'offcanvas', 'embed' ) ),
1934 ),
1935 'default' => $this->defaults[ $key . '_layout_hover_effect' ],
1936 ),
1937 array(
1938 'customizer' => true,
1939 'transport' => 'selective',
1940 'id' => $key . '_navbar_animation_text',
1941 'type' => 'animation',
1942 'title' => esc_html__( 'Text', 'quadmenu' ),
1943 'subtitle' => esc_html__( 'Select the animation for the link text.', 'quadmenu' ),
1944 'options' => array(
1945 '' => esc_html__( 'None', 'quadmenu' ),
1946 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
1947 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
1948 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
1949 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
1950 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
1951 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
1952 ),
1953 'action' => array(
1954 'load' => esc_html__( 'Load', 'quadmenu' ),
1955 'hover' => esc_html__( 'Hover', 'quadmenu' ),
1956 'loop' => esc_html__( 'Loop', 'quadmenu' ),
1957 ),
1958 'speed' => array(
1959 't_200' => 200,
1960 't_300' => 300,
1961 't_500' => 500,
1962 't_700' => 700,
1963 't_1000' => 1000,
1964 't_1500' => 1500,
1965 't_2000' => 2000,
1966 ),
1967 'default' => $this->defaults[ $key . '_navbar_animation_text' ],
1968 ),
1969 array(
1970 'customizer' => true,
1971 'transport' => 'selective',
1972 'id' => $key . '_navbar_animation_subtitle',
1973 'type' => 'animation',
1974 'title' => esc_html__( 'Subtitle', 'quadmenu' ),
1975 'subtitle' => esc_html__( 'Select the animation for the link subtitle.', 'quadmenu' ),
1976 'options' => array(
1977 '' => esc_html__( 'None', 'quadmenu' ),
1978 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
1979 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
1980 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
1981 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
1982 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
1983 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
1984 ),
1985 'action' => array(
1986 'load' => esc_html__( 'Load', 'quadmenu' ),
1987 'hover' => esc_html__( 'Hover', 'quadmenu' ),
1988 'loop' => esc_html__( 'Loop', 'quadmenu' ),
1989 ),
1990 'speed' => array(
1991 't_200' => 200,
1992 't_300' => 300,
1993 't_500' => 500,
1994 't_700' => 700,
1995 't_1000' => 1000,
1996 't_1500' => 1500,
1997 't_2000' => 2000,
1998 ),
1999 'default' => $this->defaults[ $key . '_navbar_animation_subtitle' ],
2000 ),
2001 array(
2002 'customizer' => true,
2003 'transport' => 'selective',
2004 'id' => $key . '_navbar_animation_icon',
2005 'type' => 'animation',
2006 'title' => esc_html__( 'Icon', 'quadmenu' ),
2007 'subtitle' => esc_html__( 'Select the animation for the links icons.', 'quadmenu' ),
2008 'options' => array(
2009 '' => esc_html__( 'None', 'quadmenu' ),
2010 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2011 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2012 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2013 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2014 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2015 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2016 ),
2017 'action' => array(
2018 'load' => esc_html__( 'Load', 'quadmenu' ),
2019 'hover' => esc_html__( 'Hover', 'quadmenu' ),
2020 'loop' => esc_html__( 'Loop', 'quadmenu' ),
2021 ),
2022 'speed' => array(
2023 't_200' => 200,
2024 't_300' => 300,
2025 't_500' => 500,
2026 't_700' => 700,
2027 't_1000' => 1000,
2028 't_1500' => 1500,
2029 't_2000' => 2000,
2030 ),
2031 'default' => $this->defaults[ $key . '_navbar_animation_icon' ],
2032 ),
2033 array(
2034 'customizer' => true,
2035 'transport' => 'selective',
2036 'id' => $key . '_navbar_animation_badge',
2037 'type' => 'animation',
2038 'title' => esc_html__( 'Badge', 'quadmenu' ),
2039 'subtitle' => esc_html__( 'Select the animation for the links badges.', 'quadmenu' ),
2040 'options' => array(
2041 '' => esc_html__( 'None', 'quadmenu' ),
2042 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2043 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2044 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2045 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2046 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2047 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2048 ),
2049 'action' => array(
2050 'load' => esc_html__( 'Load', 'quadmenu' ),
2051 'hover' => esc_html__( 'Hover', 'quadmenu' ),
2052 'loop' => esc_html__( 'Loop', 'quadmenu' ),
2053 ),
2054 'speed' => array(
2055 't_200' => 200,
2056 't_300' => 300,
2057 't_500' => 500,
2058 't_700' => 700,
2059 't_1000' => 1000,
2060 't_1500' => 1500,
2061 't_2000' => 2000,
2062 ),
2063 'default' => $this->defaults[ $key . '_navbar_animation_badge' ],
2064 ),
2065 array(
2066 'customizer' => true,
2067 'transport' => 'selective',
2068 'id' => $key . '_navbar_animation_cart',
2069 'type' => 'animation',
2070 'title' => esc_html__( 'Cart', 'quadmenu' ),
2071 'subtitle' => esc_html__( 'Select the animation for the cart bubble.', 'quadmenu' ),
2072 'options' => array(
2073 '' => esc_html__( 'None', 'quadmenu' ),
2074 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2075 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2076 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2077 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2078 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2079 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2080 ),
2081 'speed' => array(
2082 't_200' => 200,
2083 't_300' => 300,
2084 't_500' => 500,
2085 't_700' => 700,
2086 ),
2087 'default' => $this->defaults[ $key . '_navbar_animation_cart' ],
2088 ),
2089 array(
2090 'customizer' => true,
2091 'transport' => 'postMessage',
2092 'id' => $key . '_dropdown',
2093 'type' => 'section',
2094 'title' => esc_html__( 'Dropdown', 'quadmenu' ),
2095 'indent' => false,
2096 ),
2097 array(
2098 'customizer' => true,
2099 'transport' => 'selective',
2100 'id' => $key . '_layout_animation',
2101 'type' => 'animation',
2102 'title' => esc_html__( 'Dropdown', 'quadmenu' ),
2103 'subtitle' => esc_html__( 'Select the animation for the dropdowns.', 'quadmenu' ),
2104 'options' => array(
2105 'quadmenu_fadeIn' => esc_html__( 'FadeIn', 'quadmenu' ),
2106 'quadmenu_btt' => esc_html__( 'Bottom to top', 'quadmenu' ),
2107 'quadmenu_rtl' => esc_html__( 'Right to left', 'quadmenu' ),
2108 'quadmenu_ltr' => esc_html__( 'Left to right', 'quadmenu' ),
2109 'quadmenu_hinge' => esc_html__( 'Hinge', 'quadmenu' ),
2110 'quadmenu_flip' => esc_html__( 'Flip', 'quadmenu' ),
2111 ),
2112 'speed' => array(
2113 't_100' => 100,
2114 't_200' => 200,
2115 't_300' => 300,
2116 't_500' => 500,
2117 't_700' => 700,
2118 't_1000' => 1000,
2119 ),
2120 'default' => $this->defaults[ $key . '_layout_animation' ],
2121 'required' => array(
2122 array( $key . '_layout', '=', array( 'embed', 'collapse', 'offcanvas' ) ),
2123 ),
2124 'validate' => 'no_special_chars',
2125 ),
2126 array(
2127 'customizer' => true,
2128 'transport' => 'selective',
2129 'id' => $key . '_dropdown_animation_text',
2130 'type' => 'animation',
2131 'title' => esc_html__( 'Text', 'quadmenu' ),
2132 'subtitle' => esc_html__( 'Select the animation for the menu links.', 'quadmenu' ),
2133 'options' => array(
2134 '' => esc_html__( 'None', 'quadmenu' ),
2135 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2136 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2137 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2138 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2139 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2140 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2141 ),
2142 'action' => array(
2143 'load' => esc_html__( 'Load', 'quadmenu' ),
2144 'hover' => esc_html__( 'Hover', 'quadmenu' ),
2145 'loop' => esc_html__( 'Loop', 'quadmenu' ),
2146 ),
2147 'speed' => array(
2148 't_200' => 200,
2149 't_300' => 300,
2150 't_500' => 500,
2151 't_700' => 700,
2152 't_1000' => 1000,
2153 't_1500' => 1500,
2154 't_2000' => 2000,
2155 ),
2156 'default' => $this->defaults[ $key . '_dropdown_animation_text' ],
2157 ),
2158 array(
2159 'customizer' => true,
2160 'transport' => 'selective',
2161 'id' => $key . '_dropdown_animation_subtitle',
2162 'type' => 'animation',
2163 'title' => esc_html__( 'Subtitle', 'quadmenu' ),
2164 'subtitle' => esc_html__( 'Select the animation for the menu links.', 'quadmenu' ),
2165 'options' => array(
2166 '' => esc_html__( 'None', 'quadmenu' ),
2167 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2168 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2169 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2170 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2171 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2172 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2173 ),
2174 'action' => array(
2175 'load' => esc_html__( 'Load', 'quadmenu' ),
2176 'hover' => esc_html__( 'Hover', 'quadmenu' ),
2177 'loop' => esc_html__( 'Loop', 'quadmenu' ),
2178 ),
2179 'speed' => array(
2180 't_200' => 200,
2181 't_300' => 300,
2182 't_500' => 500,
2183 't_700' => 700,
2184 't_1000' => 1000,
2185 't_1500' => 1500,
2186 't_2000' => 2000,
2187 ),
2188 'default' => $this->defaults[ $key . '_dropdown_animation_subtitle' ],
2189 ),
2190 array(
2191 'customizer' => true,
2192 'transport' => 'selective',
2193 'id' => $key . '_dropdown_animation_icon',
2194 'type' => 'animation',
2195 'title' => esc_html__( 'Icon', 'quadmenu' ),
2196 'subtitle' => esc_html__( 'Select the animation for the menu links.', 'quadmenu' ),
2197 'options' => array(
2198 '' => esc_html__( 'None', 'quadmenu' ),
2199 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2200 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2201 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2202 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2203 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2204 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2205 ),
2206 'action' => array(
2207 'load' => esc_html__( 'Load', 'quadmenu' ),
2208 'hover' => esc_html__( 'Hover', 'quadmenu' ),
2209 'loop' => esc_html__( 'Loop', 'quadmenu' ),
2210 ),
2211 'speed' => array(
2212 't_200' => 200,
2213 't_300' => 300,
2214 't_500' => 500,
2215 't_700' => 700,
2216 't_1000' => 1000,
2217 't_1500' => 1500,
2218 't_2000' => 2000,
2219 ),
2220 'default' => $this->defaults[ $key . '_dropdown_animation_icon' ],
2221 ),
2222 array(
2223 'customizer' => true,
2224 'transport' => 'selective',
2225 'id' => $key . '_dropdown_animation_badge',
2226 'subtitle' => esc_html__( 'Select the animation for the menu links.', 'quadmenu' ),
2227 'title' => esc_html__( 'Badge', 'quadmenu' ),
2228 'type' => 'animation',
2229 'options' => array(
2230 '' => esc_html__( 'None', 'quadmenu' ),
2231 'quadmenu_bounce' => esc_html__( 'Bounce', 'quadmenu' ),
2232 'quadmenu_pulse' => esc_html__( 'Pulse', 'quadmenu' ),
2233 'quadmenu_rubberBand' => esc_html__( 'Rubber', 'quadmenu' ),
2234 'quadmenu_swing' => esc_html__( 'Swing', 'quadmenu' ),
2235 'quadmenu_tada' => esc_html__( 'Tada', 'quadmenu' ),
2236 'quadmenu_wobble' => esc_html__( 'Wobble', 'quadmenu' ),
2237 ),
2238 'action' => array(
2239 'load' => esc_html__( 'Load', 'quadmenu' ),
2240 'hover' => esc_html__( 'Hover', 'quadmenu' ),
2241 'loop' => esc_html__( 'Loop', 'quadmenu' ),
2242 ),
2243 'speed' => array(
2244 't_200' => 200,
2245 't_300' => 300,
2246 't_500' => 500,
2247 't_700' => 700,
2248 't_1000' => 1000,
2249 't_1500' => 1500,
2250 't_2000' => 2000,
2251 ),
2252 'default' => $this->defaults[ $key . '_dropdown_animation_badge' ],
2253 ),
2254 ),
2255 );
2256 }
2257
2258 return $sections;
2259 }
2260
2261 function validate( $option, $defaults ) {
2262
2263 if ( ! $option || ! in_array( sanitize_key( $option ), $defaults ) ) {
2264 return reset( $defaults );
2265 }
2266
2267 return $option;
2268 }
2269
2270 function validate_font( $options ) {
2271
2272 $defaults = array(
2273 'font-family' => 'Verdana, Geneva, sans-serif',
2274 'font-size' => '11',
2275 'font-style' => 'normal',
2276 'font-weight' => '400',
2277 'letter-spacing' => 'inherit',
2278 );
2279
2280 return wp_parse_args( (array) $options, $defaults );
2281 }
2282
2283 function validate_border( $options ) {
2284
2285 if ( ! is_array( $options ) ) {
2286 $options = array(
2287 'border-all' => $options,
2288 'border-top' => $options,
2289 'border-right' => $options,
2290 'border-left' => $options,
2291 'border-bottom' => $options,
2292 );
2293 }
2294
2295 $defaults = array(
2296 'border-all' => '0',
2297 'border-top' => '0',
2298 'border-right' => '0',
2299 'border-left' => '0',
2300 'border-bottom' => '0',
2301 'border-color' => '#000000',
2302 );
2303
2304 return wp_parse_args( (array) $options, $defaults );
2305 }
2306
2307 public static function instance() {
2308 if ( ! isset( self::$instance ) ) {
2309 self::$instance = new self();
2310 }
2311 return self::$instance;
2312 }
2313 }
2314