Make WordPress Core


Ignore:
Timestamp:
10/17/2014 08:51:46 PM (12 years ago)
Author:
iandstewart
Message:

Twenty Fifteen: Removing unused custom color controls.

Props cainm, fixes #29982 and #29959.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/inc/customizer.php

    r29942 r29944  
    2828        ) );
    2929
    30         $wp_customize->add_control( new Twentyfifteen_Customize_Color_Scheme_Control( $wp_customize, 'color_scheme', array(
     30        $wp_customize->add_control( 'color_scheme', array(
    3131                'label'    => esc_html__( 'Color Scheme', 'twentyfifteen' ),
    3232                'section'  => 'colors',
     33                'type'     => 'select',
    3334                'choices'  => twentyfifteen_get_color_scheme_choices(),
    3435                'priority' => 1,
    35         ) ) );
     36        ) );
    3637
    3738        // Add custom sidebar text color setting and control.
    … …  
    5859}
    5960add_action( 'customize_register', 'twentyfifteen_customize_register', 11 );
    60 
    61 /**
    62  * Custom control for Color Schemes
    63  *
    64  * @since Twenty Fifteen 1.0
    65  */
    66 function twentyfifteen_customize_color_scheme_control() {
    67         class Twentyfifteen_Customize_Color_Scheme_Control extends WP_Customize_Control {
    68                 public $type = 'colorScheme';
    69 
    70                 function enqueue() {
    71                         wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls' ), '', true  );
    72                         wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );
    73                 }
    74 
    75                 public function render_content() {
    76                         if ( empty( $this->choices ) )
    77                                 return;
    78 
    79                         ?>
    80                         <label>
    81                                 <?php if ( ! empty( $this->label ) ) : ?>
    82                                         <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
    83                                 <?php endif;
    84                                 if ( ! empty( $this->description ) ) : ?>
    85                                         <span class="description customize-control-description"><?php echo $this->description; ?></span>
    86                                 <?php endif; ?>
    87 
    88                                 <select <?php $this->link(); ?>>
    89                                         <?php
    90                                         foreach ( $this->choices as $value => $label )
    91                                                 echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';
    92                                         ?>
    93                                 </select>
    94                         </label>
    95                         <?php
    96                 }
    97         }
    98 }
    99 add_action( 'customize_register', 'twentyfifteen_customize_color_scheme_control', 10 );
    10061
    10162/**
    … …  
    662623
    663624/**
     625 * Binds JS listener to make Customizer color_scheme control.
     626 * Passes color scheme data as colorScheme global
     627 *
     628 * @since Twenty Fifteen 1.0
     629 */
     630function twentyfifteen_customize_control_js() {
     631        wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls' ), '', true  );
     632        wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );
     633}
     634add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' );
     635
     636/**
    664637 * Binds JS handlers to make Customizer preview reload changes asynchronously.
    665638 *
Note: See TracChangeset for help on using the changeset viewer.