visible = get_theme_mod( $args['hiding_control'] ); $this->visible = hester()->options->get( $args['hiding_control'] ); } add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue' ) ); } /** * Enqueue control related scripts/styles. * * @access public */ public function enqueue() { // Script debug. $hester_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // Control type. $hester_type = str_replace( 'hester-', '', $this->type ); /** * Enqueue control stylesheet */ wp_enqueue_style( 'hester-' . $hester_type . '-control-style', HESTER_THEME_URI . '/inc/customizer/controls/' . $hester_type . '/' . $hester_type . $hester_suffix . '.css', false, HESTER_THEME_VERSION, 'all' ); wp_enqueue_script( 'hester-' . $hester_type . '-control', HESTER_THEME_URI . '/inc/customizer/controls/' . $hester_type . '/' . $hester_type . $hester_suffix . '.js', array( 'jquery' ), HESTER_THEME_VERSION, true ); wp_enqueue_script( 'hester-' . $hester_type . '-ordering-control', HESTER_THEME_URI . '/inc/customizer/controls/' . $hester_type . '/section-ordering' . $hester_suffix . '.js', array( 'jquery', 'jquery-ui-sortable', 'customize-controls' ), HESTER_THEME_VERSION, true ); $control_settings = array( 'sections_container' => '#accordion-panel-hester_panel_homepage > ul, #sub-accordion-panel-hester_panel_homepage', 'blocked_items' => '#accordion-section-hester_section_slider', 'saved_data_input' => '#customize-control-hester_sections_order input', ); wp_localize_script( 'hester-' . $hester_type . '-ordering-control', 'control_settings', $control_settings ); wp_localize_script( 'hester-' . $hester_type . '-control', 'hester_customizer_sections', array( 'sections' => hester_home_sections() ) ); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public */ public function json() { $json = parent::json(); $json['visible'] = $this->visible; $json['hiding_control'] = $this->hiding_control; return $json; } /** * Outputs the Underscore.js template. * * @since 1.0.0 * @access public * @return void */ protected function render_template() { ?>