is_tab = $args['is_tab']; if (!empty($args['is_subtab']) && $args['is_subtab'] === true) { $this->is_subtab = $args['is_subtab']; } if (!empty($this->choices)) { foreach ($this->choices as $value => $args) { $this->controls[$value] = $args['controls']; } } if (array_key_exists('subcontrols', $args)) { $this->subcontrols = esc_attr($args['subcontrols']); } } } public function enqueue() { $css_path = DIVI_TORQUE_LITE_URL . '/includes/deprecated/customizer/controls/css/'; $file_prefix = (defined('DTQ_DEBUG') && true === constant('DTQ_DEBUG')) ? '' : '.min'; wp_enqueue_style('brainaddons-radio-image', $css_path . 'radio-image' . $file_prefix . '.css', false, DIVI_TORQUE_LITE_VERSION); wp_enqueue_script('jquery-ui-button'); } public function json() { $json = parent::json(); $json['is_tab'] = $this->is_tab; $json['is_subtab'] = $this->is_subtab; if ($json['is_tab'] === true) { $json['controls'] = $this->controls; } // We need to make sure we have the correct image URL. $json['choices'] = $this->choices; $json['width'] = 100; if (!empty($this->choices)) { $json['width'] = number_format(100 / count($this->choices), 2); } $json['id'] = $this->id; $json['link'] = $this->get_link(); $json['value'] = $this->value(); $json['subcontrols'] = $this->subcontrols; return $json; } public function content_template() { ?> <# if ( ! data.choices ) { return; } #> <# if( !data.is_tab) {#> <# if ( data.label ) { #> {{ data.label }} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> <#}#>
<# for ( key in data.choices ) { #> data-controls="{{data.controls[key]}}"<#}#> type="radio" value="{{ key }}" name="_customize-{{ data.type }}-{{ data.id }}" id="{{ data.id }}-{{ key }}" <# if ( key===data.value && ( !data.is_tab || data.is_subtab) ) { #> checked="checked" <# } #> {{{ data.link }}} /> <# } #>