panels. * * @access public * @since 1.0 * @param string $id The panel ID. * @param array $args The panel arguments. */ public function panel_added( $id, $args ) { if ( isset( $args['icon'] ) ) { $args['id'] = $id; $this->panels[] = $args; } } /** * Hooks in kirki_section_added to populate $this->sections. * * @access public * @since 1.0 * @param string $id The section ID. * @param array $args The section arguments. */ public function section_added( $id, $args ) { if ( isset( $args['icon'] ) ) { $args['id'] = $id; $this->sections[] = $args; } } /** * Format the script in a way that will be compatible with WordPress. */ public function customize_controls_enqueue_scripts() { // Parse panels and find ones with icons. foreach ( $this->panels as $panel ) { $this->add_icon( $panel['id'], $panel['icon'], 'panel' ); } // Parse sections and find ones with icons. foreach ( $this->sections as $section ) { $this->add_icon( $section['id'], $section['icon'], 'section' ); } wp_enqueue_script( 'kirki_panel_and_section_icons', URL::get_from_path( __DIR__ . '/icons.js' ), [ 'jquery', 'customize-base', 'customize-controls' ], '1.0', true ); wp_localize_script( 'kirki_panel_and_section_icons', 'kirkiIcons', self::$icons ); } }