public function add_section($args) { $this->wp_customize->add_section(sanitize_key($args['id']), array('title' => esc_textarea($args['title']), 'priority' => esc_attr($args['priority']), 'panel' => esc_attr($args['panel']), 'description' => esc_textarea($args['description']), 'active_callback' => $args['active_callback'])); if (isset($args['icon'])) { $args['context'] = 'section'; Nova_Customizer_Scripts_Icons::generate_script($args); } }
/** * Add the panel using the Customizer API * * @var $args the panel arguments */ public function add_panel($args) { // Add the panel using the customizer API $this->wp_customize->add_panel(sanitize_key($args['id']), array('title' => esc_textarea($args['title']), 'priority' => esc_attr($args['priority']), 'description' => esc_textarea($args['description']), 'active_callback' => $args['active_callback'])); // If we've got an icon then call the object to create its script. if (isset($args['icon'])) { $args['context'] = 'panel'; Nova_Customizer_Scripts_Icons::generate_script($args); } }
/** * Format the script in a way that will be compatible with WordPress. * * @return void (echoes the script) */ public function enqueue_script() { if (!self::$script_added && '' != self::$icons_script) { self::$script_added = true; echo '<script>jQuery(document).ready(function($) { "use strict"; ' . self::$icons_script . '});</script>'; } }