palette = $args['palette']; } parent::__construct($manager, $id, $args); } /** * enqueue css and scrpts * * @since 1.0.0 */ public function enqueue() { wp_enqueue_style('appzend-color-tab-control', get_template_directory_uri() . '/inc/custom-controller/color-tab/color-tab.css', array(), '1.0.0'); wp_enqueue_script('appzend-color-tab-control', get_template_directory_uri().'/inc/custom-controller/color-tab/color-tab.js', array( 'jquery', 'jquery-ui-slider' ), '1.0.0', true); } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); // Process the palette if (is_array($this->palette)) { $palette_string = implode('|', $this->palette); } else { // Default to true. $palette_string = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true'; } $this->json['show_opacity'] = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true'; $this->json['group'] = array(); $this->json['l10n'] = $this->l10n(); $this->json['group'] = $this->group; $this->json['palette'] = $palette_string; foreach ($this->settings as $setting_key => $setting) { list( $_key ) = explode('_', $setting_key); $this->json[$_key][$setting_key] = array( 'id' => $setting->id, 'link' => $this->get_link($setting_key), 'value' => $this->value($setting_key), 'default' => $setting->default ); } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> <# if ( data.label ) { #>
<# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> esc_attr__('Normal', 'appzend'), 'hover' => esc_attr__('Hover', 'appzend') ); if (false === $id) { return $translation_strings; } return $translation_strings[$id]; } } $wp_customize->register_control_type('AppZend_Color_Tab_Control'); endif;