false, 'h_length' => false, 'v_length' => false, 'blur' => false, 'spread' => 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.h_length ) { #>
<# const h_reset = ( resetData !== '' && resetData['h_length'] !== undefined ) ? resetData['h_length'] : ''; #>
    <#_.each( data.units, function( unit_key, unit_index ) { const unit_class = unit_index === 0 ? 'single-unit active' : 'single-unit'; #>
  • {{{ unit_key }}}
  • <# }); #>
<# } #> <# if ( fields.v_length ) { #>
<# const v_reset = ( resetData !== '' && resetData['v_length'] !== undefined ) ? resetData['v_length'] : ''; #>
    <#_.each( data.units, function( unit_key, unit_index ) { const unit_class = unit_index === 0 ? 'single-unit active' : 'single-unit'; #>
  • {{{ unit_key }}}
  • <# }); #>
<# } #> <# if ( fields.blur ) { #>
<# const blur_reset = ( resetData !== '' && resetData['blur'] !== undefined ) ? resetData['blur'] : ''; #>
    <#_.each( data.units, function( unit_key, unit_index ) { const unit_class = unit_index === 0 ? 'single-unit active' : 'single-unit'; #>
  • {{{ unit_key }}}
  • <# }); #>
<# } #> <# if ( fields.spread ) { #>
<# const spread_reset = ( resetData !== '' && resetData['spread'] !== undefined ) ? resetData['spread'] : ''; #>
    <#_.each( data.units, function( unit_key, unit_index ) { const unit_class = unit_index === 0 ? 'single-unit active' : 'single-unit'; #>
  • {{{ unit_key }}}
  • <# }); #>
<# } #> <# 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.inset ) { #>
<# const inset_reset = ( resetData !== '' && resetData['inset'] !== undefined ) ? resetData['inset'] : ''; #>
<# } #>
register_control_type( 'Blogin_Aarambha_Customize_Box_Shadow_Control' );