~canonical-sysadmins/wordpress/4.7.2

« back to all changes in this revision

Viewing changes to wp-includes/customize/class-wp-customize-color-control.php

  • Committer: Haw Loeung
  • Date: 2016-12-13 06:56:21 UTC
  • mfrom: (1.1.20 upstream)
  • Revision ID: haw.loeung@canonical.com-20161213065621-8tcu7u7vlxgs2s81
Merge WP4.7 from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 */
17
17
class WP_Customize_Color_Control extends WP_Customize_Control {
18
18
        /**
 
19
         * Type.
 
20
         *
19
21
         * @access public
20
22
         * @var string
21
23
         */
22
24
        public $type = 'color';
23
25
 
24
26
        /**
 
27
         * Statuses.
 
28
         *
25
29
         * @access public
26
30
         * @var array
27
31
         */
28
32
        public $statuses;
29
33
 
30
34
        /**
 
35
         * Mode.
 
36
         *
 
37
         * @since 4.7.0
 
38
         * @access public
 
39
         * @var string
 
40
         */
 
41
        public $mode = 'full';
 
42
 
 
43
        /**
31
44
         * Constructor.
32
45
         *
33
46
         * @since 3.4.0
62
75
                parent::to_json();
63
76
                $this->json['statuses'] = $this->statuses;
64
77
                $this->json['defaultValue'] = $this->setting->default;
 
78
                $this->json['mode'] = $this->mode;
65
79
        }
66
80
 
67
81
        /**
78
92
         */
79
93
        public function content_template() {
80
94
                ?>
81
 
                <# var defaultValue = '';
82
 
                if ( data.defaultValue ) {
 
95
                <# var defaultValue = '',
 
96
                        isHueSlider = data.mode === 'hue';
 
97
 
 
98
                if ( data.defaultValue && ! isHueSlider ) {
83
99
                        if ( '#' !== data.defaultValue.substring( 0, 1 ) ) {
84
100
                                defaultValue = '#' + data.defaultValue;
85
101
                        } else {
95
111
                                <span class="description customize-control-description">{{{ data.description }}}</span>
96
112
                        <# } #>
97
113
                        <div class="customize-control-content">
98
 
                                <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>" {{ defaultValue }} />
 
114
                                <# if ( isHueSlider ) { #>
 
115
                                        <input class="color-picker-hue" type="text" data-type="hue" />
 
116
                                <# } else { #>
 
117
                                        <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>" {{ defaultValue }} />
 
118
                                <# } #>
99
119
                        </div>
100
120
                </label>
101
121
                <?php