Skip to content

Commit 2e3d8c0

Browse files
authored
Merge pull request #1449 from danielortiz/multicolor_alpha_option
Adds alpha option to multicolor control
2 parents cc46724 + 4d26c97 commit 2e3d8c0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

controls/multicolor/class-kirki-control-multicolor.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ class Kirki_Control_Multicolor extends WP_Customize_Control {
4343
*/
4444
public $option_type = 'theme_mod';
4545

46+
/**
47+
* Enable/Disable Alpha channel on color pickers
48+
*
49+
* @access public
50+
* @var boolean
51+
*/
52+
public $alpha = true;
53+
4654
/**
4755
* Constructor.
4856
*
@@ -72,6 +80,7 @@ class Kirki_Control_Multicolor extends WP_Customize_Control {
7280
* @type array $choices List of choices for 'radio' or 'select' type controls, where
7381
* values are the keys, and labels are the values.
7482
* Default empty array.
83+
* @type boolean $alpha Enables/Disables alpha channel on color pickers
7584
* @type array $input_attrs List of custom input attributes for control output, where
7685
* attribute names are the keys and values are the values. Not
7786
* used for 'checkbox', 'radio', 'select', 'textarea', or
@@ -129,6 +138,7 @@ public function to_json() {
129138
$this->json['choices'] = $this->choices;
130139
$this->json['link'] = $this->get_link();
131140
$this->json['id'] = $this->id;
141+
$this->json['alpha'] = $this->alpha;
132142

133143
$this->json['inputAttrs'] = '';
134144
foreach ( $this->input_attrs as $attr => $value ) {
@@ -162,7 +172,7 @@ protected function content_template() {
162172
<# if ( data.choices[ key ] ) { #>
163173
<label for="{{ data.id }}-{{ key }}">{{ data.choices[ key ] }}</label>
164174
<# } #>
165-
<input {{{ data.inputAttrs }}} id="{{ data.id }}-{{ key }}" type="text" data-palette="{{ data.palette }}" data-default-color="{{ data.default[ key ] }}" data-alpha="true" value="{{ data.value[ key ] }}" class="kirki-color-control color-picker multicolor-index-{{ key }}" />
175+
<input {{{ data.inputAttrs }}} id="{{ data.id }}-{{ key }}" type="text" data-palette="{{ data.palette }}" data-default-color="{{ data.default[ key ] }}" data-alpha="{{ data.alpha }}" value="{{ data.value[ key ] }}" class="kirki-color-control color-picker multicolor-index-{{ key }}" />
166176
</div>
167177
<# } #>
168178
<# } #>

0 commit comments

Comments
 (0)