<# var i18n = { general: '', radius: '', shadow: '', separator: '' }; var defaults = { style: '', color: '', width: { top: '', right: '', bottom: '', left: '', }, radius: { top_left: '', top_right: '', bottom_left: '', bottom_right: '', }, shadow: { color: '', horizontal: '', vertical: '', blur: '', spread: '', }, }; var disabledDefaults = { default: {}, large: {}, medium: {}, responsive: {} }; var shadowRadiusLabel = []; var value = '' === data.value ? defaults : jQuery.extend( true, defaults, data.value ); var device = data.device ? data.device : 'default'; var disabledFields = {}; var disabled = []; if (typeof data.field.disabled !== 'undefined') { disabledFields = jQuery.extend( true, disabledDefaults, data.field.disabled ) } else { disabledFields = disabledDefaults } jQuery.each(disabledFields[device], function(i,v){ disabled.push(v) }) // Helper function to check if a field is enabled. var flBorderControlEnabled = function( field ) { if (jQuery.inArray(field, disabled ) !== -1 ) { return false } return true; } // set label if (flBorderControlEnabled('radius')) { shadowRadiusLabel.push(i18n.radius) } if (flBorderControlEnabled('shadow')) { shadowRadiusLabel.push(i18n.shadow) } var style = wp.template( 'fl-builder-field-select' )( { name: data.name + '[][style]', value: value.style, field: { options: { '': '', 'none': '', 'solid': '', 'dashed': '', 'dotted': '', 'double': '', }, }, } ); var color = wp.template( 'fl-builder-field-color' )( { name: data.name + '[][color]', value: value.color, field: { className: 'fl-border-field-color', show_reset: true, show_alpha: true, }, } ); var width = wp.template( 'fl-builder-field-dimension' )( { name: data.name, rootName: data.name, names: { top: data.name + '[][width][top]', right: data.name + '[][width][right]', bottom: data.name + '[][width][bottom]', left: data.name + '[][width][left]', }, values: { top: value.width.top, right: value.width.right, bottom: value.width.bottom, left: value.width.left, }, field: { units: [ 'px' ], slider: true, }, } ); var radius = wp.template( 'fl-builder-field-dimension' )( { name: data.name, rootName: data.name, names: { top_left: data.name + '[][radius][top_left]', top_right: data.name + '[][radius][top_right]', bottom_left: data.name + '[][radius][bottom_left]', bottom_right: data.name + '[][radius][bottom_right]', }, values: { top_left: value.radius.top_left, top_right: value.radius.top_right, bottom_left: value.radius.bottom_left, bottom_right: value.radius.bottom_right, }, field: { units: [ 'px' ], slider: true, keys: { top_left: '', top_right: '', bottom_left: '', bottom_right: '', }, }, } ); var shadow = wp.template( 'fl-builder-field-shadow' )( { name: data.name + '[][shadow]', value: value.shadow, field: { show_spread: true, }, } ); #>
<# if ( shadowRadiusLabel.length > 0 ) { #>
{{{i18n.general}}}
<# } #>
{{{style}}}
{{{color}}}
{{{width}}}
<# if ( shadowRadiusLabel.length > 0 ) { #>
{{{shadowRadiusLabel.join(' ' + i18n.separator + ' ')}}}
<# if ( flBorderControlEnabled( 'radius' ) ) { #>
{{{radius}}}
<# } #> <# if ( flBorderControlEnabled( 'shadow' ) ) { #>
{{{shadow}}}
<# } #>
<# } #>