array( * 'type' => 'select', * 'label' => esc_html__( 'Select Field', 'fl-builder' ), * 'default' => 'option-1', * 'className' => '', * 'multi-select' => false, * 'options' => array( * 'option-1' => esc_html__( 'Option 1', 'fl-builder' ), * 'option-2' => array( * 'label' => esc_html__( 'Premium Option 2', 'fl-builder' ), * 'premium' => true, * ), * 'optgroup-1' => array( * 'label' => esc_html__( 'Optgroup 1', 'fl-builder' ), * 'options' => array( * * 'option-3' => esc_html__( 'Option 3', 'fl-builder' ), * 'option-4' => array( * 'label' => esc_html__( 'Premium Option 4', 'fl-builder' ), * 'premium' => true, * ), * ), * 'premium' => false, * ), * ), * 'toggle' => array( * 'option-1' => array( * 'fields' => array( 'my_field_1', 'my_field_2' ), * 'sections' => array( 'my_section' ), * 'tabs' => array( 'my_tab' ), * ), * 'option-2' => array(), * ), * 'hide' => '', @todo Write example setup attribute value * 'trigger' => '', @todo Write example setup attribute value * ); * */ ?> <# var atts = '', field = data.field, name = data.name, value = data.value; // Multiselect? if ( field['multi-select'] ) { atts += ' multiple'; name += '[]'; } // Class if ( field.className ) { atts += ' class="' + field.className + '"'; } // Toggle data if ( field.toggle ) { atts += " data-toggle='" + JSON.stringify( field.toggle ) + "'"; } // Hide data if ( field.hide ) { atts += " data-hide='" + JSON.stringify( field.hide ) + "'"; } // Trigger data if ( field.trigger ) { atts += " data-trigger='" + JSON.stringify( field.trigger ) + "'"; } // Referenced Option Sets - See FLBuilderConfig.optionSets if ( ( Array.isArray( field.options ) && field.options.length === 1 ) || 'string' === typeof field.options ) { var optionSetName = Array.isArray( field.options ) ? field.options[0] : field.options ; if ( 'undefined' !== typeof optionSetName ) { var optionSet = FLBuilderConfig.optionSets[optionSetName]; if ( 'undefined' !== typeof optionSet ) { field.options = optionSet; } } } // Saved data if ( field.saved_data ) { templates = FLBuilderConfig.contentItems.template; var dataOption = [], savedOpt = _.filter(templates, function(item) { return field.saved_data === item.content && 'user' === item.type; }); if ( savedOpt ) { _.each(savedOpt, function(option){ dataOption[option.postId] = option.name; }); } if ( dataOption.length === 0 ) { if ( 'row' === field.saved_data ) { dataOption[''] = ''; } if ( 'column' === field.saved_data ) { dataOption[''] = ''; } if ( 'module' === field.saved_data ) { dataOption[''] = ''; } if ( 'layout' === field.saved_data ) { dataOption[''] = ''; } } field.options = dataOption; } #>