array( 'color' => $color_value ), * $value => array( 'color' => $color_value ), * )` * */ /** * Radio color customize control. * * @since 3.0.0 * @access public */ class Smooth_Blog_Customize_Control_Radio_Color extends WP_Customize_Control { /** * The type of customize control being rendered. * * @since 3.0.0 * @access public * @var string */ public $type = 'radio-color'; /** * Add custom parameters to pass to the JS via JSON. * * @since 3.0.0 * @access public * @return void */ public function to_json() { parent::to_json(); // We need to make sure we have the correct color URL. foreach ( $this->choices as $value => $args ) $this->choices[ $value ]['color'] = esc_attr( $args['color'] ); $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['value'] = $this->value(); $this->json['id'] = $this->id; } /** * Don't render the content via PHP. This control is handled with a JS template. * * @since 4.0.0 * @access public * @return bool */ protected function render_content() {} /** * Underscore JS template to handle the control's output. * * @since 3.0.0 * @access public * @return void */ public function content_template() { ?> <# if ( ! data.choices ) { return; } #> <# if ( data.label ) { #> {{ data.label }} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> <# _.each( data.choices, function( args, choice ) { #> <# } ) #> register_control_type( 'smooth_blog_Customize_Control_Radio_Color'); class Smooth_Blog_Customize_Control_Sort_Sections extends WP_Customize_Control { /** * Control Type */ public $type = 'sortable'; /** * Add custom parameters to pass to the JS via JSON. * * @access public * @return void */ public function to_json() { parent::to_json(); $choices = $this->choices; $choices = array_filter( array_merge( array_flip( $this->value() ), $choices ) ); $this->json['choices'] = $choices; $this->json['link'] = $this->get_link(); $this->json['value'] = $this->value(); $this->json['id'] = $this->id; } /** * Render Settings */ public function content_template() { ?> <# if ( ! data.choices ) { return; } #> <# if ( data.label ) { #> {{ data.label }} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> register_control_type( 'smooth_blog_Customize_Control_Sort_Sections' );