#
let _current_value = ( typeof data.field_information.default !== 'undefined' ? data.field_information.default : null );
if( typeof data.field_information.value !== "undefined" ) {
_current_value = data.field_information.value;
}
#>
<# if( data.field_information.type === "repeater_order" ) { #>
{{{ PaymentPage.settings.svg_icon_map.element_order }}}
<# } else if( data.field_information.type === "raw_html" ) { #>
{{{ data.field_information.html }}}
<# } else if( payment_page_in_array(data.field_information.type, [ "text", "number", "link", "url", "color" ] ) ) { #>
type="text"
<# } else if( data.field_information.type === "number" ) { #>
type="number"
<# } else if( data.field_information.type === "link" || data.field_information.type === "url" ) { #>
type="url"
<# } else if( data.field_information.type === "color" ) { #>
type="text"
data-payment-page-library="colorpicker"
<# } #>
value="{{ _current_value !== null ? _current_value : '' }}"
placeholder="{{ typeof data.field_information.placeholder !== 'undefined' ? data.field_information.placeholder : '' }}"
<# if( typeof data.field_information.admin_label !== 'undefined' && data.field_information.admin_label ) { #>
data-payment-page-is-admin-label="1"
<# } #>
<# if( typeof data.field_information.readonly !== 'undefined' && data.field_information.readonly ) { #>
readonly="readonly"
<# } #>
<# if( typeof data.field_information.disabled !== 'undefined' && data.field_information.disabled === "disabled" ) { #>
disabled="disabled"
<# } #>
<# if( typeof data.field_information.attributes !== "undefined" ) { #>
<# _.each( data.field_information.attributes, function( attribute_value, attribute_name ) { #>
{{ attribute_name }}="{{ typeof attribute_value === "object" ? _.escape(JSON.stringify( attribute_value )) : attribute_value }}"
<# }) #>
<# } #>
/>
<# } else if( payment_page_in_array(data.field_information.type, [ "css_style_border_color", "css_style_background_color" ] ) ) { #>
<# _.each( data.field_information.attributes, function( attribute_value, attribute_name ) { #>
{{ attribute_name }}="{{ typeof attribute_value === "object" ? _.escape(JSON.stringify( attribute_value )) : attribute_value }}"
<# }) #>
<# } #>
/>
<# } else if( data.field_information.type === "true_false" ) { #>
<# } else if( data.field_information.type === "toggle" ) { #>
<# } else if( data.field_information.type === "css_style_unit" ) { #>
<#
if( !( _current_value instanceof Object ) ) {
_current_value = { unit : "", size : "" };
}
let _size_units = ( typeof data.field_information.size_units !== 'undefined' && data.field_information.size_units instanceof Array ? data.field_information.size_units : [ 'px', '%', 'em' ] );
#>
<# } else if( data.field_information.type === "css_style_unit_dimensions" ) { #>
<#
if( !( _current_value instanceof Object ) ) {
_current_value = { unit : "", size_1 : "", size_2 : "", size_3 : "", size_4 : "" };
}
let _size_units = ( typeof data.field_information.size_units !== 'undefined' && data.field_information.size_units instanceof Array ? data.field_information.size_units : [ 'px', '%', 'em' ] );
#>
<# } else if( data.field_information.type === "message_builder" ) { #>
<#
if( !( _current_value instanceof Object ) ) {
_current_value = { token_map : {}, token_order : [] };
}
if( typeof _current_value.token_order === 'undefined' ) {
_current_value = { token_map : {}, token_order : [] };
}
#>
<# _.each( data.field_information.pieces, function( current_piece_field_information ) { #>
<# current_piece_field_information.default = ( typeof _current_value.token_map[ current_piece_field_information.name ] !== 'undefined' ? _current_value.token_map[ current_piece_field_information.name ] : null ); #>
<# var args = { field_information : current_piece_field_information,
field_input_name : data.field_input_name + "[token_map][" + current_piece_field_information.name + "]",
_has_label : 1 };
#>
-
{{{ PaymentPage.Template.get( "form", "template/field.html", args ) }}}
<# }) #>
Drag to reorder
<# } else if( data.field_information.type === "textarea" ) { #>
<# } else if( data.field_information.type === "editor" ) { #>
<# } else if( data.field_information.type === "multiple_select" ) { #>
<#
let _selected = ( _current_value !== null && _current_value instanceof Array ? _current_value : [] );
#>
<# } else if( data.field_information.type === "select" ) { #>
<# } else if( data.field_information.type === "attachment_image" ) { #>
<# } else if( data.field_information.type === "post_id" || data.field_information.type === "post_ids" ) { #>
<# } else if( data.field_information.type === "form_fields_map" ) { #>
<# } else if( data.field_information.type === "repeater" ) { #>
<# var _layout = ( typeof data.field_information.layout !== 'undefined' ? data.field_information.layout : 'default' ); #>
<# var allow_add = ( typeof data.field_information.allow_add !== 'undefined' ? data.field_information.allow_add : 1 ); #>
<# var allow_delete = ( typeof data.field_information.allow_delete !== 'undefined' ? data.field_information.allow_delete : 1 ); #>
<# if( _layout === "basic" ) { #>
<# if( _current_value !== null && ( Array.isArray( _current_value ) || ( typeof _current_value === "object" && _current_value !== null && Object.keys( _current_value ).length > 0 ) ) ) { #>
<# var i = 1; #>
<# _.each( _current_value, function( repeater_value, repeater_index ) { #>
<# var field_namespace = data.field_input_name + '[' + ( typeof repeater_value.__repeater_index !== 'undefined' ? repeater_value.__repeater_index : repeater_index ) + ']';
var fields_parsed = payment_page_form_field_repeater_parse_value(data.field_information.fields, repeater_value); #>
{{{ PaymentPage.Template.get( 'form', 'template/default', { fields : fields_parsed, field_namespace : field_namespace } ) }}}
<# i++ #>
<# }) #>
<# } #>
<# } else { #>
<# if( _current_value !== null && ( Array.isArray( _current_value ) || ( typeof _current_value === "object" && _current_value !== null && Object.keys( _current_value ).length > 0 ) ) ) { #>
<# var i = 1; #>
<# _.each( _current_value, function( repeater_value, repeater_index ) { #>
<# var field_namespace = data.field_input_name + '[' + ( typeof repeater_value.__repeater_index !== 'undefined' ? repeater_value.__repeater_index : repeater_index ) + ']';
var fields_parsed = payment_page_form_field_repeater_parse_value(data.field_information.fields, repeater_value);
var _has_admin_label = false;
#>
{{{ PaymentPage.settings.svg_icon_map.element_order }}}
<# _.each( fields_parsed, function( parsed_field_information ) { #>
<# if( typeof parsed_field_information.admin_label !== 'undefined' && parsed_field_information.admin_label ) { #>
{{ parsed_field_information.value }}
<# _has_admin_label = true; #>
<# } #>
<# }) #>
<# if( !_has_admin_label ) { #>
Item #{{ i }}
<# } #>
{{{ PaymentPage.settings.svg_icon_map.angle_down }}}
{{{ PaymentPage.Template.get( 'form', 'template/default', { fields : fields_parsed, field_namespace : field_namespace } ) }}}
<# i++ #>
<# }) #>
<# } #>
<# } #>
<# if( allow_add ) { #>
<# } #>
<# } else { #>
This field type is not currently integrated : {{ data.field_information.type }}
<# } #>