false, 'style' => false, 'radius' => false, 'colors' => false ); $fields = []; $fields_exist = !empty( $this->fields ) ? $this->fields : $default_fields; foreach( $fields_exist as $field_key => $field_value ){ $fields[ str_replace( '-', '_', $field_key ) ] = true; } $fields = wp_parse_args( $fields, $default_fields ); // Fields $this->json['fields'] = $fields; } /** * Underscore JS template to handle the control's output. * * @access public * @return void */ public function content_template() { ?> <# const fields = data.fields, resetData = data.default, inheritData = data.inherits; #> <# if ( data.label ) { #>
{{{ data.label }}}
<# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #>
<# if ( fields.width ) { #>
    <#_.each( data.units, function( unit_key, unit_index ) { const unit_class = unit_index === 0 ? 'single-unit active' : 'single-unit'; #>
  • {{{ unit_key }}}
  • <# }); #>
<# const linked_reset = ( resetData !== '' && resetData['width'] !== undefined && resetData['width']['linked'] !== undefined ) ? resetData['width']['linked'] : ''; #>
<# } #> <# if ( fields.style ) { #>
<# const style_reset = ( resetData !== '' && resetData['style'] !== undefined ) ? resetData['style'] : ''; #>
<# } #> <# if ( fields.colors ) { const colors = data.colors; #>
<# Object.keys( colors ).forEach( function ( key ) { #>
style="background:{{ inheritData[key] }}" <# } #>> <# let color_reset = ( resetData !== '' && resetData['colors'] !== undefined && resetData['colors'][key] !== undefined ) ? resetData['colors'][key] : ''; #> <# let color_inherit = ( inheritData !== '' && inheritData[key] !== undefined ) ? inheritData[key] : ''; #>
<# }); #>
<# } #> <# if ( fields.radius ) { #>
<# const radius_reset = ( resetData !== '' && resetData['radius'] !== undefined ) ? resetData['radius'] : ''; #>
    <#_.each( data.units, function( unit_key, unit_index ) { const unit_class = unit_index === 0 ? 'single-unit active' : 'single-unit'; #>
  • {{{ unit_key }}}
  • <# }); #>
<# } #>
register_control_type( 'Business_Aarambha_Customize_Border_Control' );