false, 'image' => false, 'position' => false, 'attachment' => false, 'repeat' => false, 'size' => false, 'colors' => false, 'gradient' => 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.background ) { #>
<# if ( fields.colors ) { #> <# } #> <# if ( fields.gradient ) { #> <# } #> <# if ( fields.image ) { #> <# } #>
<# } #> <# if ( fields.image ) { #>
<# const img_reset = ( resetData !== '' && resetData['image'] !== undefined ) ? resetData['image'] : ''; #>
<# } #> <# if ( fields.position ) { #>
<# const position_reset = ( resetData !== '' && resetData['position'] !== undefined ) ? resetData['position'] : ''; #>
<# } #> <# if ( fields.attachment ) { #>
<# const attachment_reset = ( resetData !== '' && resetData['attachment'] !== undefined ) ? resetData['attachment'] : ''; #>
<# } #> <# if ( fields.repeat ) { #>
<# const repeat_reset = ( resetData !== '' && resetData['repeat'] !== undefined ) ? resetData['repeat'] : ''; #>
<# } #> <# if ( fields.size ) { #>
<# const size_reset = ( resetData !== '' && resetData['size'] !== undefined ) ? resetData['size'] : ''; #>
<# } #> <# 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.gradient ) { const gradients = { color_1: 'Color Left', color_2: 'Color Right' } #>
<# Object.keys( gradients ).forEach( function ( key, index ) { #>
<# let gradient_reset = ( resetData !== '' && resetData['gradient'] !== undefined && resetData['gradient'][key] !== undefined ) ? resetData['gradient'][key] : ''; #>
<# }); #>
<# } #>
register_control_type( 'Business_Aarambha_Customize_Background_Control' );