palette = $args['palette'];
}
if (isset($args['hide_control'])) {
$this->hide_control = $args['hide_control'];
}
if (isset($args['show_opacity'])) {
$this->show_opacity = $args['show_opacity'];
}
parent::__construct($manager, $id, $args);
}
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
parent::to_json();
// Process the palette
if (is_array($this->palette)) {
$palette_string = implode('|', $this->palette);
} else {
// Default to true.
$palette_string = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
}
$this->json['show_opacity'] = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
$this->json['group'] = array();
$this->json['l10n'] = $this->l10n();
$this->json['group'] = $this->group;
$this->json['palette'] = $palette_string;
$this->json['hide_control'] = $this->hide_control;
$this->json['hide_control_style'] = $this->hide_control ? 'style="display:none"' : '';
foreach ($this->settings as $setting_key => $setting) {
list( $_key ) = explode('_', $setting_key);
$this->json[$_key][$setting_key] = array(
'id' => $setting->id,
'link' => $this->get_link($setting_key),
'value' => $this->value($setting_key),
'default' => $setting->default
);
}
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*
* @access protected
*/
protected function content_template() {
?>
<# if ( data.label ) { #>
<# } #>
<# if ( data.hide_control ) { #>