PluginProbe ʕ •ᴥ•ʔ
Menu Icons by Themeisle – Add Icons to Navigation Menus / 0.12.6
Menu Icons by Themeisle – Add Icons to Navigation Menus v0.12.6
trunk 0.1.0 0.1.1 0.1.2 0.1.3 0.1.4 0.1.5 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.11.2 0.11.3 0.11.4 0.11.5 0.12.0 0.12.1 0.12.10 0.12.11 0.12.12 0.12.2 0.12.3 0.12.4 0.12.5 0.12.6 0.12.7 0.12.8 0.12.9 0.13.0 0.13.1 0.13.10 0.13.11 0.13.12 0.13.13 0.13.14 0.13.15 0.13.16 0.13.17 0.13.18 0.13.19 0.13.2 0.13.20 0.13.21 0.13.22 0.13.23 0.13.3 0.13.4 0.13.5 0.13.6 0.13.7 0.13.8 0.13.9 0.2.0 0.2.1 0.2.2 0.2.3 0.3.0 0.3.1 0.3.2 0.4.0 0.5.0 0.5.1 0.6.0 0.7.0 0.8.0 0.8.1 0.9.0 0.9.2
menu-icons / includes / settings.php
menu-icons / includes Last commit date
library 6 years ago front.php 5 years ago media-template.php 10 years ago meta.php 8 years ago picker.php 5 years ago settings.php 5 years ago type-fonts.php 10 years ago type.php 10 years ago
settings.php
768 lines
1 <?php
2
3 /**
4 * Settings
5 *
6 * @package Menu_Icons
7 * @author Dzikri Aziz <kvcrvt@gmail.com>
8 */
9
10 /**
11 * Menu Icons Settings module
12 */
13 final class Menu_Icons_Settings {
14
15 const UPDATE_KEY = 'menu-icons-settings-update';
16
17 const RESET_KEY = 'menu-icons-settings-reset';
18
19 const TRANSIENT_KEY = 'menu_icons_message';
20
21 /**
22 * Default setting values
23 *
24 * @since 0.3.0
25 * @var array
26 * @access protected
27 */
28 protected static $defaults = array(
29 'global' => array(
30 'icon_types' => array( 'dashicons' ),
31 ),
32 );
33
34 /**
35 * Setting values
36 *
37 * @since 0.3.0
38 * @var array
39 * @access protected
40 */
41 protected static $settings = array();
42
43 /**
44 * Script dependencies
45 *
46 * @since 0.9.0
47 * @access protected
48 * @var array
49 */
50 protected static $script_deps = array( 'jquery' );
51
52 /**
53 * Settings init
54 *
55 * @since 0.3.0
56 */
57 public static function init() {
58 // Include Menu Icons for Block Editor
59 if ( class_exists( '\ThemeIsle\GutenbergMenuIcons' ) ) {
60 \ThemeIsle\GutenbergMenuIcons::instance();
61 add_action( 'enqueue_block_assets', array( __CLASS__, '_enqueue_font_awesome' ) );
62 }
63
64 /**
65 * Allow themes/plugins to override the default settings
66 *
67 * @since 0.9.0
68 *
69 * @param array $default_settings Default settings.
70 */
71 self::$defaults = apply_filters( 'menu_icons_settings_defaults', self::$defaults );
72
73 self::$settings = get_option( 'menu-icons', self::$defaults );
74
75 foreach ( self::$settings as $key => &$value ) {
76 if ( 'global' === $key ) {
77 // Remove unregistered icon types.
78 $value['icon_types'] = array_values(
79 array_intersect(
80 array_keys( Menu_Icons::get( 'types' ) ),
81 array_filter( (array) $value['icon_types'] )
82 )
83 );
84 } else {
85 // Backward-compatibility.
86 if ( isset( $value['width'] ) && ! isset( $value['svg_width'] ) ) {
87 $value['svg_width'] = $value['width'];
88 }
89
90 unset( $value['width'] );
91 }
92 }
93
94 unset( $value );
95
96 /**
97 * Allow themes/plugins to override the settings
98 *
99 * @since 0.9.0
100 *
101 * @param array $settings Menu Icons settings.
102 */
103 self::$settings = apply_filters( 'menu_icons_settings', self::$settings );
104
105 if ( self::is_menu_icons_disabled_for_menu() ) {
106 return;
107 }
108
109 if ( ! empty( self::$settings['global']['icon_types'] ) ) {
110 require_once Menu_Icons::get( 'dir' ) . 'includes/picker.php';
111 Menu_Icons_Picker::init();
112 self::$script_deps[] = 'icon-picker';
113 }
114
115 add_action( 'load-nav-menus.php', array( __CLASS__, '_load_nav_menus' ), 1 );
116 add_action( 'wp_ajax_menu_icons_update_settings', array( __CLASS__, '_ajax_menu_icons_update_settings' ) );
117 }
118
119 /**
120 * Check if menu icons is disabled for a menu
121 *
122 * @since 0.8.0
123 *
124 * @param int $menu_id Menu ID. Defaults to current menu being edited.
125 *
126 * @return bool
127 */
128 public static function is_menu_icons_disabled_for_menu( $menu_id = 0 ) {
129 if ( empty( $menu_id ) ) {
130 $menu_id = self::get_current_menu_id();
131 }
132
133 // When we're creating a new menu or the recently edited menu
134 // could not be found.
135 if ( empty( $menu_id ) ) {
136 return true;
137 }
138
139 $menu_settings = self::get_menu_settings( $menu_id );
140 $is_disabled = ! empty( $menu_settings['disabled'] );
141
142 return $is_disabled;
143 }
144
145 /**
146 * Get ID of menu being edited
147 *
148 * @since 0.7.0
149 * @since 0.8.0 Get the recently edited menu from user option.
150 *
151 * @return int
152 */
153 public static function get_current_menu_id() {
154 global $nav_menu_selected_id;
155
156 if ( ! empty( $nav_menu_selected_id ) ) {
157 return $nav_menu_selected_id;
158 }
159
160 if ( is_admin() && isset( $_REQUEST['menu'] ) ) {
161 $menu_id = absint( $_REQUEST['menu'] );
162 } else {
163 $menu_id = absint( get_user_option( 'nav_menu_recently_edited' ) );
164 }
165
166 return $menu_id;
167 }
168
169 /**
170 * Get menu settings
171 *
172 * @since 0.3.0
173 *
174 * @param int $menu_id
175 *
176 * @return array
177 */
178 public static function get_menu_settings( $menu_id ) {
179 $menu_settings = self::get( sprintf( 'menu_%d', $menu_id ) );
180 $menu_settings = apply_filters( 'menu_icons_menu_settings', $menu_settings, $menu_id );
181
182 if ( ! is_array( $menu_settings ) ) {
183 $menu_settings = array();
184 }
185
186 return $menu_settings;
187 }
188
189 /**
190 * Get setting value
191 *
192 * @since 0.3.0
193 * @return mixed
194 */
195 public static function get() {
196 $args = func_get_args();
197
198 return kucrut_get_array_value_deep( self::$settings, $args );
199 }
200
201 /**
202 * Prepare wp-admin/nav-menus.php page
203 *
204 * @since 0.3.0
205 * @wp_hook action load-nav-menus.php
206 */
207 public static function _load_nav_menus() {
208 add_action( 'admin_enqueue_scripts', array( __CLASS__, '_enqueue_assets' ), 99 );
209
210 /**
211 * Allow settings meta box to be disabled.
212 *
213 * @since 0.4.0
214 *
215 * @param bool $disabled Defaults to FALSE.
216 */
217 $settings_disabled = apply_filters( 'menu_icons_disable_settings', false );
218 if ( true === $settings_disabled ) {
219 return;
220 }
221
222 self::_maybe_update_settings();
223 self::_add_settings_meta_box();
224
225 add_action( 'admin_notices', array( __CLASS__, '_admin_notices' ) );
226 }
227
228 /**
229 * Update settings
230 *
231 * @since 0.3.0
232 */
233 public static function _maybe_update_settings() {
234 if ( ! empty( $_POST['menu-icons']['settings'] ) ) {
235 check_admin_referer( self::UPDATE_KEY, self::UPDATE_KEY );
236
237 $redirect_url = self::_update_settings( $_POST['menu-icons']['settings'] ); // Input var okay.
238 wp_redirect( $redirect_url );
239 } elseif ( ! empty( $_REQUEST[ self::RESET_KEY ] ) ) {
240 check_admin_referer( self::RESET_KEY, self::RESET_KEY );
241 wp_redirect( self::_reset_settings() );
242 }
243 }
244
245 /**
246 * Update settings
247 *
248 * @since 0.7.0
249 * @access protected
250 *
251 * @param array $values Settings values.
252 *
253 * @return string Redirect URL.
254 */
255 protected static function _update_settings( $values ) {
256 update_option(
257 'menu-icons',
258 wp_parse_args(
259 kucrut_validate( $values ),
260 self::$settings
261 )
262 );
263 set_transient( self::TRANSIENT_KEY, 'updated', 30 );
264
265 $redirect_url = remove_query_arg(
266 array( 'menu-icons-reset' ),
267 wp_get_referer()
268 );
269
270 return $redirect_url;
271 }
272
273 /**
274 * Reset settings
275 *
276 * @since 0.7.0
277 * @access protected
278 * @return string Redirect URL.
279 */
280 protected static function _reset_settings() {
281 delete_option( 'menu-icons' );
282 set_transient( self::TRANSIENT_KEY, 'reset', 30 );
283
284 $redirect_url = remove_query_arg(
285 array( self::RESET_KEY, 'menu-icons-updated' ),
286 wp_get_referer()
287 );
288
289 return $redirect_url;
290 }
291
292 /**
293 * Settings meta box
294 *
295 * @since 0.3.0
296 * @access private
297 */
298 private static function _add_settings_meta_box() {
299 add_meta_box(
300 'menu-icons-settings',
301 __( 'Menu Icons Settings', 'menu-icons' ),
302 array( __CLASS__, '_meta_box' ),
303 'nav-menus',
304 'side',
305 'low',
306 array()
307 );
308 }
309
310 /**
311 * Update settings via ajax
312 *
313 * @since 0.7.0
314 * @wp_hook action wp_ajax_menu_icons_update_settings
315 */
316 public static function _ajax_menu_icons_update_settings() {
317 check_ajax_referer( self::UPDATE_KEY, self::UPDATE_KEY );
318
319 if ( empty( $_POST['menu-icons']['settings'] ) ) {
320 wp_send_json_error();
321 }
322
323 $redirect_url = self::_update_settings( $_POST['menu-icons']['settings'] ); // Input var okay.
324 wp_send_json_success( array( 'redirectUrl' => $redirect_url ) );
325 }
326
327 /**
328 * Print admin notices
329 *
330 * @since 0.3.0
331 * @wp_hook action admin_notices
332 */
333 public static function _admin_notices() {
334 $messages = array(
335 'updated' => __( '<strong>Menu Icons Settings</strong> have been successfully updated.', 'menu-icons' ),
336 'reset' => __( '<strong>Menu Icons Settings</strong> have been successfully reset.', 'menu-icons' ),
337 );
338
339 $message_type = get_transient( self::TRANSIENT_KEY );
340
341 if ( ! empty( $message_type ) && ! empty( $messages[ $message_type ] ) ) {
342 printf(
343 '<div class="updated notice is-dismissible"><p>%s</p></div>',
344 wp_kses( $messages[ $message_type ], array( 'strong' => true ) )
345 );
346 }
347
348 delete_transient( self::TRANSIENT_KEY );
349 }
350
351 /**
352 * Settings meta box
353 *
354 * @since 0.3.0
355 */
356 public static function _meta_box() {
357 ?>
358 <div class="taxonomydiv">
359 <ul id="menu-icons-settings-tabs" class="taxonomy-tabs add-menu-item-tabs hide-if-no-js">
360 <?php foreach ( self::get_fields() as $section ) : ?>
361 <?php
362 printf(
363 '<li><a href="#" title="%s" class="mi-settings-nav-tab" data-type="menu-icons-settings-%s">%s</a></li>',
364 esc_attr( $section['description'] ),
365 esc_attr( $section['id'] ),
366 esc_html( $section['title'] )
367 );
368 ?>
369 <?php endforeach; ?>
370 <?php
371 printf(
372 '<li><a href="#" class="mi-settings-nav-tab" data-type="menu-icons-settings-extensions">%s</a></li>',
373 esc_html__( 'Extensions', 'menu-icons' )
374 );
375 ?>
376 </ul>
377 <?php foreach ( self::_get_fields() as $section_index => $section ) : ?>
378 <div id="menu-icons-settings-<?php echo esc_attr( $section['id'] ) ?>"
379 class="tabs-panel _<?php echo esc_attr( $section_index ) ?>">
380 <h4 class="hide-if-js"><?php echo esc_html( $section['title'] ) ?></h4>
381 <?php foreach ( $section['fields'] as $field ) : ?>
382 <div class="_field">
383 <?php
384 printf(
385 '<label for="%s" class="_main">%s</label>',
386 esc_attr( $field->id ),
387 esc_html( $field->label )
388 );
389 ?>
390 <?php $field->render() ?>
391 </div>
392 <?php endforeach; ?>
393 </div>
394 <?php endforeach; ?>
395 <div id="menu-icons-settings-extensions" class="tabs-panel _extensions">
396 <h4 class="hide-if-js"><?php echo esc_html__( 'Extensions', 'menu-icons' ) ?></h4>
397 <ul>
398 <li><a target="_blank" href="http://wordpress.org/plugins/menu-icons-icomoon/">IcoMoon</a></li>
399 </ul>
400 </div>
401 </div>
402 <p class="submitbox button-controls">
403 <?php wp_nonce_field( self::UPDATE_KEY, self::UPDATE_KEY ) ?>
404 <span class="list-controls">
405 <?php
406 printf(
407 '<a href="%s" title="%s" class="select-all submitdelete">%s</a>',
408 esc_url(
409 wp_nonce_url(
410 admin_url( '/nav-menus.php' ),
411 self::RESET_KEY,
412 self::RESET_KEY
413 )
414 ),
415 esc_attr__( 'Discard all changes and reset to default state', 'menu-icons' ),
416 esc_html__( 'Reset', 'menu-icons' )
417 );
418 ?>
419 </span>
420
421 <span class="add-to-menu">
422 <span class="spinner"></span>
423 <?php
424 submit_button(
425 __( 'Save Settings', 'menu-icons' ),
426 'secondary',
427 'menu-icons-settings-save',
428 false
429 );
430 ?>
431 </span>
432 </p>
433 <?php
434 }
435
436 /**
437 * Get settings sections
438 *
439 * @since 0.3.0
440 * @uses apply_filters() Calls 'menu_icons_settings_sections'.
441 * @return array
442 */
443 public static function get_fields() {
444 $menu_id = self::get_current_menu_id();
445 $icon_types = wp_list_pluck( Menu_Icons::get( 'types' ), 'name' );
446
447 asort( $icon_types );
448
449 $sections = array(
450 'global' => array(
451 'id' => 'global',
452 'title' => __( 'Global', 'menu-icons' ),
453 'description' => __( 'Global settings', 'menu-icons' ),
454 'fields' => array(
455 array(
456 'id' => 'icon_types',
457 'type' => 'checkbox',
458 'label' => __( 'Icon Types', 'menu-icons' ),
459 'choices' => $icon_types,
460 'value' => self::get( 'global', 'icon_types' ),
461 ),
462 ),
463 'args' => array(),
464 ),
465 );
466
467 if ( ! empty( $menu_id ) ) {
468 $menu_term = get_term( $menu_id, 'nav_menu' );
469 $menu_key = sprintf( 'menu_%d', $menu_id );
470 $menu_settings = self::get_menu_settings( $menu_id );
471
472 $sections['menu'] = array(
473 'id' => $menu_key,
474 'title' => __( 'Current Menu', 'menu-icons' ),
475 'description' => sprintf(
476 __( '"%s" menu settings', 'menu-icons' ),
477 apply_filters( 'single_term_title', $menu_term->name )
478 ),
479 'fields' => self::get_settings_fields( $menu_settings ),
480 'args' => array( 'inline_description' => true ),
481 );
482 }
483
484 return apply_filters( 'menu_icons_settings_sections', $sections, $menu_id );
485 }
486
487 /**
488 * Get settings fields
489 *
490 * @since 0.4.0
491 *
492 * @param array $values Values to be applied to each field.
493 *
494 * @uses apply_filters() Calls 'menu_icons_settings_fields'.
495 * @return array
496 */
497 public static function get_settings_fields( array $values = array() ) {
498 $fields = array(
499 'hide_label' => array(
500 'id' => 'hide_label',
501 'type' => 'select',
502 'label' => __( 'Hide Label', 'menu-icons' ),
503 'default' => '',
504 'choices' => array(
505 array(
506 'value' => '',
507 'label' => __( 'No', 'menu-icons' ),
508 ),
509 array(
510 'value' => '1',
511 'label' => __( 'Yes', 'menu-icons' ),
512 ),
513 ),
514 ),
515 'position' => array(
516 'id' => 'position',
517 'type' => 'select',
518 'label' => __( 'Position', 'menu-icons' ),
519 'default' => 'before',
520 'choices' => array(
521 array(
522 'value' => 'before',
523 'label' => __( 'Before', 'menu-icons' ),
524 ),
525 array(
526 'value' => 'after',
527 'label' => __( 'After', 'menu-icons' ),
528 ),
529 ),
530 ),
531 'vertical_align' => array(
532 'id' => 'vertical_align',
533 'type' => 'select',
534 'label' => __( 'Vertical Align', 'menu-icons' ),
535 'default' => 'middle',
536 'choices' => array(
537 array(
538 'value' => 'super',
539 'label' => __( 'Super', 'menu-icons' ),
540 ),
541 array(
542 'value' => 'top',
543 'label' => __( 'Top', 'menu-icons' ),
544 ),
545 array(
546 'value' => 'text-top',
547 'label' => __( 'Text Top', 'menu-icons' ),
548 ),
549 array(
550 'value' => 'middle',
551 'label' => __( 'Middle', 'menu-icons' ),
552 ),
553 array(
554 'value' => 'baseline',
555 'label' => __( 'Baseline', 'menu-icons' ),
556 ),
557 array(
558 'value' => 'text-bottom',
559 'label' => __( 'Text Bottom', 'menu-icons' ),
560 ),
561 array(
562 'value' => 'bottom',
563 'label' => __( 'Bottom', 'menu-icons' ),
564 ),
565 array(
566 'value' => 'sub',
567 'label' => __( 'Sub', 'menu-icons' ),
568 ),
569 ),
570 ),
571 'font_size' => array(
572 'id' => 'font_size',
573 'type' => 'number',
574 'label' => __( 'Font Size', 'menu-icons' ),
575 'default' => '1.2',
576 'description' => 'em',
577 'attributes' => array(
578 'min' => '0.1',
579 'step' => '0.1',
580 ),
581 ),
582 'svg_width' => array(
583 'id' => 'svg_width',
584 'type' => 'number',
585 'label' => __( 'SVG Width', 'menu-icons' ),
586 'default' => '1',
587 'description' => 'em',
588 'attributes' => array(
589 'min' => '.5',
590 'step' => '.1',
591 ),
592 ),
593 'image_size' => array(
594 'id' => 'image_size',
595 'type' => 'select',
596 'label' => __( 'Image Size', 'menu-icons' ),
597 'default' => 'thumbnail',
598 'choices' => kucrut_get_image_sizes(),
599 ),
600 );
601
602 $fields = apply_filters( 'menu_icons_settings_fields', $fields );
603
604 foreach ( $fields as &$field ) {
605 if ( isset( $values[ $field['id'] ] ) ) {
606 $field['value'] = $values[ $field['id'] ];
607 }
608
609 if ( ! isset( $field['value'] ) && isset( $field['default'] ) ) {
610 $field['value'] = $field['default'];
611 }
612 }
613
614 unset( $field );
615
616 return $fields;
617 }
618
619 /**
620 * Get processed settings fields
621 *
622 * @since 0.3.0
623 * @access private
624 * @return array
625 */
626 private static function _get_fields() {
627 if ( ! class_exists( 'Kucrut_Form_Field' ) ) {
628 require_once Menu_Icons::get( 'dir' ) . 'includes/library/form-fields.php';
629 }
630
631 $keys = array( 'menu-icons', 'settings' );
632 $sections = self::get_fields();
633
634 foreach ( $sections as &$section ) {
635 $_keys = array_merge( $keys, array( $section['id'] ) );
636 $_args = array_merge( array( 'keys' => $_keys ), $section['args'] );
637
638 foreach ( $section['fields'] as &$field ) {
639 $field = Kucrut_Form_Field::create( $field, $_args );
640 }
641
642 unset( $field );
643 }
644
645 unset( $section );
646
647 return $sections;
648 }
649
650 /**
651 * Enqueue scripts & styles for Block Icons
652 *
653 * @since 0.3.0
654 * @wp_hook action enqueue_block_assets
655 */
656 public static function _enqueue_font_awesome() {
657 $url = Menu_Icons::get( 'url' );
658
659 wp_register_style(
660 'font-awesome-5',
661 "{$url}css/fontawesome/css/all.min.css"
662 );
663 }
664
665 /**
666 * Enqueue scripts & styles for Appearance > Menus page
667 *
668 * @since 0.3.0
669 * @wp_hook action admin_enqueue_scripts
670 */
671 public static function _enqueue_assets() {
672 $url = Menu_Icons::get( 'url' );
673 $suffix = kucrut_get_script_suffix();
674
675 if ( defined( 'MENU_ICONS_SCRIPT_DEBUG' ) && MENU_ICONS_SCRIPT_DEBUG ) {
676 $script_url = '//localhost:8081/';
677 } else {
678 $script_url = $url;
679 }
680
681 wp_enqueue_style(
682 'menu-icons',
683 "{$url}css/admin{$suffix}.css",
684 false,
685 Menu_Icons::VERSION
686 );
687
688 wp_enqueue_script(
689 'menu-icons',
690 "{$script_url}js/admin{$suffix}.js",
691 self::$script_deps,
692 Menu_Icons::VERSION,
693 true
694 );
695
696 $customizer_url = add_query_arg(
697 array(
698 'autofocus[section]' => 'custom_css',
699 'return' => admin_url( 'nav-menus.php' ),
700 ),
701 admin_url( 'customize.php' )
702 );
703
704 /**
705 * Allow plugins/themes to filter the settings' JS data
706 *
707 * @since 0.9.0
708 *
709 * @param array $js_data JS Data.
710 */
711 $menu_current_theme = '';
712 $theme = wp_get_theme();
713 if ( ! empty( $theme ) ) {
714 if ( is_child_theme() && $theme->parent() ) {
715 $menu_current_theme = $theme->parent()->get( 'Name' );
716 } else {
717 $menu_current_theme = $theme->get( 'Name' );
718 }
719 }
720 $box_data = '<div id="menu-icons-sidebar">';
721 if ( ( $menu_current_theme != 'Neve' ) ) {
722
723 $menu_upgrade_hestia_box_text = '<h4>Check-out our latest fast and lightweight FREE theme - <strong>Neve</strong></h4>Neve’s mobile-first approach, compatibility with AMP and popular page-builders makes website building accessible for everyone.';
724
725 $menu_upgrade_hestia_url = add_query_arg(
726 array(
727 'theme' => 'Neve',
728 ), admin_url( 'theme-install.php' )
729 );
730 $box_data .= '<div class="menu-icons-upgrade-hestia postbox new-card">';
731 $box_data .= '<p>' . wp_kses_post( $menu_upgrade_hestia_box_text ) . '</p>';
732 $box_data .= '<a class="button" href="' . $menu_upgrade_hestia_url . '" target="_blank">Preview Neve</a>';
733 $box_data .= '</div>';
734 }
735 $js_data = apply_filters(
736 'menu_icons_settings_js_data',
737 array(
738 'text' => array(
739 'title' => __( 'Select Icon', 'menu-icons' ),
740 'select' => __( 'Select', 'menu-icons' ),
741 'remove' => __( 'Remove', 'menu-icons' ),
742 'change' => __( 'Change', 'menu-icons' ),
743 'all' => __( 'All', 'menu-icons' ),
744 'preview' => __( 'Preview', 'menu-icons' ),
745 'settingsInfo' => sprintf(
746 '<div> %1$s <p>' . esc_html__( 'Please note that the actual look of the icons on the front-end will also be affected by the style of your active theme. You can add your own CSS using %2$s or a plugin such as %3$s if you need to override it.', 'menu-icons' ) . '</p></div>',
747 $box_data,
748 sprintf(
749 '<a href="%s">%s</a>',
750 esc_url( $customizer_url ),
751 esc_html__( 'the customizer', 'menu-icons' )
752 ),
753 '<a target="_blank" href="https://wordpress.org/plugins/advanced-css-editor/">Advanced CSS Editor</a>'
754 ),
755 ),
756 'settingsFields' => self::get_settings_fields(),
757 'activeTypes' => self::get( 'global', 'icon_types' ),
758 'ajaxUrls' => array(
759 'update' => add_query_arg( 'action', 'menu_icons_update_settings', admin_url( '/admin-ajax.php' ) ),
760 ),
761 'menuSettings' => self::get_menu_settings( self::get_current_menu_id() ),
762 )
763 );
764
765 wp_localize_script( 'menu-icons', 'menuIcons', $js_data );
766 }
767 }
768