Make WordPress Core


Ignore:
Timestamp:
09/27/2012 01:57:38 AM (14 years ago)
Author:
nacin
Message:

New color picker, props mattwiebe. see #21206.

Replaces Farbtastic. May change further in response to user testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-control.php

    r21497 r22030  
    352352         */
    353353        public function enqueue() {
    354                 wp_enqueue_script( 'farbtastic' );
    355                 wp_enqueue_style( 'farbtastic' );
     354                wp_enqueue_script( 'wp-color-picker' );
     355                wp_enqueue_style( 'wp-color-picker' );
    356356        }
    357357
    … …  
    373373         */
    374374        public function render_content() {
     375                $this_default = $this->setting->default;
     376                $default_attr = '';
     377                if ( $this_default ) {
     378                        if ( false === strpos( $this_default, '#' ) )
     379                                $this_default = '#' . $this_default;
     380                        $default_attr = ' data-default-color="' . esc_attr( $this_default ) . '"';
     381                }
     382                // The input's value gets set by JS. Don't fill it.
    375383                ?>
    376384                <label>
    377385                        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
    378386                        <div class="customize-control-content">
    379                                 <div class="dropdown">
    380                                         <div class="dropdown-content">
    381                                                 <div class="dropdown-status"></div>
    382                                         </div>
    383                                         <div class="dropdown-arrow"></div>
    384                                 </div>
    385                                 <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e('Hex Value'); ?>" />
     387                                <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>"<?php echo $default_attr ?> />
    386388                        </div>
    387                         <div class="farbtastic-placeholder"></div>
    388389                </label>
    389390                <?php
Note: See TracChangeset for help on using the changeset viewer.