class;
$json['accordion'] = $this->accordion;
$json['category_label'] = $this->category_label;
if ( $this->accordion === true ) {
$json['classes'] .= ' accordion';
}
$json['style'] = $this->print_style();
return $json;
}
/**
* Render the control.
*/
protected function render() {
$id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
$class = 'customize-control customize-control-' . $this->type;
$class .= ' ' . $this->class;
if ( $this->accordion ) {
$class .= ' accordion';
}
if ( $this->expanded ) {
$class .= ' expanded';
}
echo '
';
echo '';
}
/**
* 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.category_label) {#>
{{data.category_label}}
<# }#>
{{ data.label }}
<# if(data.accordion) { #>
<# } #>
{{{data.style}}}
';
for ( $i = 1; $i <= $this->controls_to_wrap; $i ++ ) {
$style .= '.accordion.' . $this->class . ':not(.expanded)';
for ( $j = 1; $j <= $i; $j ++ ) {
$style .= ' + li';
}
if ( $i !== $this->controls_to_wrap ) {
$style .= ',';
}
}
$style .= '{max-height: 0;opacity: 0;margin: 0; overflow: hidden; padding:0 !important;}';
$style .= '';
return $style;
}
}