Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wpforms-.../assets/js/admin/builder
File: admin-builder.js
defaults: false,
[4000] Fix | Delete
};
[4001] Fix | Delete
[4002] Fix | Delete
options = $.extend( {}, defaults, options );
[4003] Fix | Delete
[4004] Fix | Delete
const data = {
[4005] Fix | Delete
action: 'wpforms_new_field_' + type,
[4006] Fix | Delete
id: s.formID,
[4007] Fix | Delete
type,
[4008] Fix | Delete
defaults: options.defaults,
[4009] Fix | Delete
nonce: wpforms_builder.nonce,
[4010] Fix | Delete
};
[4011] Fix | Delete
[4012] Fix | Delete
return $.post( wpforms_builder.ajax_url, data, function( res ) { // eslint-disable-line complexity
[4013] Fix | Delete
if ( ! res.success ) {
[4014] Fix | Delete
wpf.debug( 'Add field AJAX call is unsuccessful:', res );
[4015] Fix | Delete
[4016] Fix | Delete
return;
[4017] Fix | Delete
}
[4018] Fix | Delete
[4019] Fix | Delete
const $baseFieldsContainer = elements.$sortableFieldsWrap,
[4020] Fix | Delete
$newField = $( res.data.preview ),
[4021] Fix | Delete
$newOptions = $( res.data.options );
[4022] Fix | Delete
[4023] Fix | Delete
let $fieldContainer = options.$sortable;
[4024] Fix | Delete
[4025] Fix | Delete
adding = false;
[4026] Fix | Delete
[4027] Fix | Delete
$newField.css( 'display', 'none' );
[4028] Fix | Delete
[4029] Fix | Delete
if ( options.placeholder ) {
[4030] Fix | Delete
options.placeholder.remove();
[4031] Fix | Delete
}
[4032] Fix | Delete
[4033] Fix | Delete
if ( options.$sortable === 'default' || ! options.$sortable.length ) {
[4034] Fix | Delete
$fieldContainer = $baseFieldsContainer.find( '.wpforms-fields-sortable-default' );
[4035] Fix | Delete
}
[4036] Fix | Delete
[4037] Fix | Delete
if ( options.$sortable === 'base' || ! $fieldContainer.length ) {
[4038] Fix | Delete
$fieldContainer = $baseFieldsContainer;
[4039] Fix | Delete
}
[4040] Fix | Delete
[4041] Fix | Delete
const event = WPFormsUtils.triggerEvent(
[4042] Fix | Delete
$builder,
[4043] Fix | Delete
'wpformsBeforeFieldAddToDOM',
[4044] Fix | Delete
[ options, $newField, $newOptions, $fieldContainer ]
[4045] Fix | Delete
);
[4046] Fix | Delete
[4047] Fix | Delete
// Allow callbacks on `wpformsBeforeFieldAddToDOM` to cancel adding field
[4048] Fix | Delete
// by triggering `event.preventDefault()`.
[4049] Fix | Delete
if ( event.isDefaultPrevented() ) {
[4050] Fix | Delete
return;
[4051] Fix | Delete
}
[4052] Fix | Delete
[4053] Fix | Delete
// Add field to the base level of fields.
[4054] Fix | Delete
// Allow callbacks on `wpformsBeforeFieldAddToDOM` to skip adding field to the base level
[4055] Fix | Delete
// by setting `event.skipAddFieldToBaseLevel = true`.
[4056] Fix | Delete
if ( ! event.skipAddFieldToBaseLevel ) {
[4057] Fix | Delete
app.fieldAddToBaseLevel( options, $newField, $newOptions );
[4058] Fix | Delete
}
[4059] Fix | Delete
[4060] Fix | Delete
$newField.fadeIn();
[4061] Fix | Delete
[4062] Fix | Delete
$builder.find( '.no-fields, .no-fields-preview' ).remove();
[4063] Fix | Delete
[4064] Fix | Delete
if ( $( '.wpforms-field-option:not(.wpforms-field-option-layout)' ).length ) {
[4065] Fix | Delete
$builder.find( '.wpforms-field-submit' ).show();
[4066] Fix | Delete
}
[4067] Fix | Delete
[4068] Fix | Delete
// Scroll to the added field.
[4069] Fix | Delete
if ( options.scroll && options.position.length ) {
[4070] Fix | Delete
app.scrollPreviewToField( res.data.field.id );
[4071] Fix | Delete
}
[4072] Fix | Delete
[4073] Fix | Delete
// Update next field id hidden input value.
[4074] Fix | Delete
elements.$nextFieldId.val( res.data.field.id + 1 );
[4075] Fix | Delete
[4076] Fix | Delete
wpf.initTooltips();
[4077] Fix | Delete
app.loadColorPickers();
[4078] Fix | Delete
app.toggleAllOptionGroups();
[4079] Fix | Delete
[4080] Fix | Delete
$builder.trigger( 'wpformsFieldAdd', [ res.data.field.id, type ] );
[4081] Fix | Delete
} ).fail( function( xhr, textStatus, e ) { // eslint-disable-line no-unused-vars
[4082] Fix | Delete
adding = false;
[4083] Fix | Delete
[4084] Fix | Delete
wpf.debug( 'Add field AJAX call failed:', xhr.responseText );
[4085] Fix | Delete
} ).always( function() {
[4086] Fix | Delete
if ( ! adding ) {
[4087] Fix | Delete
WPForms.Admin.Builder.DragFields.enableDragAndDrop();
[4088] Fix | Delete
app.enableFormActions();
[4089] Fix | Delete
}
[4090] Fix | Delete
} );
[4091] Fix | Delete
},
[4092] Fix | Delete
[4093] Fix | Delete
/**
[4094] Fix | Delete
* Add new field to the base level of fields.
[4095] Fix | Delete
*
[4096] Fix | Delete
* @since 1.7.7
[4097] Fix | Delete
*
[4098] Fix | Delete
* @param {Object} options Field add additional options.
[4099] Fix | Delete
* @param {jQuery} $newField New field preview object.
[4100] Fix | Delete
* @param {jQuery} $newOptions New field options object.
[4101] Fix | Delete
*/
[4102] Fix | Delete
fieldAddToBaseLevel( options, $newField, $newOptions ) { // eslint-disable-line complexity
[4103] Fix | Delete
const $baseFieldsContainer = elements.$sortableFieldsWrap,
[4104] Fix | Delete
$baseFields = $baseFieldsContainer.find( '> :not(.wpforms-field-drag-pending)' ),
[4105] Fix | Delete
totalBaseFields = $baseFields.length;
[4106] Fix | Delete
[4107] Fix | Delete
const $fieldOptions = elements.$fieldOptions;
[4108] Fix | Delete
[4109] Fix | Delete
if ( options.position === 'top' ) {
[4110] Fix | Delete
// Add field to the top of base level fields.
[4111] Fix | Delete
$baseFieldsContainer.prepend( $newField );
[4112] Fix | Delete
$fieldOptions.prepend( $newOptions );
[4113] Fix | Delete
[4114] Fix | Delete
return;
[4115] Fix | Delete
}
[4116] Fix | Delete
[4117] Fix | Delete
const $lastBaseField = $baseFields.last();
[4118] Fix | Delete
[4119] Fix | Delete
if (
[4120] Fix | Delete
options.position === 'bottom' && (
[4121] Fix | Delete
! $lastBaseField.length ||
[4122] Fix | Delete
! $lastBaseField.hasClass( 'wpforms-field-stick' )
[4123] Fix | Delete
)
[4124] Fix | Delete
) {
[4125] Fix | Delete
// Add field to the bottom of base level fields.
[4126] Fix | Delete
$baseFieldsContainer.append( $newField );
[4127] Fix | Delete
$fieldOptions.append( $newOptions );
[4128] Fix | Delete
[4129] Fix | Delete
return;
[4130] Fix | Delete
}
[4131] Fix | Delete
[4132] Fix | Delete
if ( options.position === 'bottom' ) {
[4133] Fix | Delete
options.position = totalBaseFields;
[4134] Fix | Delete
}
[4135] Fix | Delete
[4136] Fix | Delete
if (
[4137] Fix | Delete
options.position === totalBaseFields &&
[4138] Fix | Delete
$lastBaseField.length && $lastBaseField.hasClass( 'wpforms-field-stick' )
[4139] Fix | Delete
) {
[4140] Fix | Delete
const lastBaseFieldId = $lastBaseField.data( 'field-id' );
[4141] Fix | Delete
[4142] Fix | Delete
// Check to see if the last field we have is configured to
[4143] Fix | Delete
// be stuck to the bottom, if so add the field above it.
[4144] Fix | Delete
$lastBaseField.before( $newField );
[4145] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-${ lastBaseFieldId }` ).before( $newOptions );
[4146] Fix | Delete
[4147] Fix | Delete
return;
[4148] Fix | Delete
}
[4149] Fix | Delete
[4150] Fix | Delete
const $fieldInPosition = $baseFieldsContainer.children( ':not(.wpforms-field-drag-pending)' ).eq( options.position );
[4151] Fix | Delete
[4152] Fix | Delete
if ( $fieldInPosition.length ) {
[4153] Fix | Delete
const fieldInPositionId = $fieldInPosition.data( 'field-id' );
[4154] Fix | Delete
[4155] Fix | Delete
// Add field to a specific location.
[4156] Fix | Delete
$fieldInPosition.before( $newField );
[4157] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-${ fieldInPositionId }` ).before( $newOptions );
[4158] Fix | Delete
[4159] Fix | Delete
return;
[4160] Fix | Delete
}
[4161] Fix | Delete
[4162] Fix | Delete
// Something is wrong. Add the field. This should never occur.
[4163] Fix | Delete
$baseFieldsContainer.append( $newField );
[4164] Fix | Delete
$fieldOptions.append( $newOptions );
[4165] Fix | Delete
},
[4166] Fix | Delete
[4167] Fix | Delete
/**
[4168] Fix | Delete
* Scroll the preview panel to the desired field.
[4169] Fix | Delete
*
[4170] Fix | Delete
* @since 1.7.7
[4171] Fix | Delete
*
[4172] Fix | Delete
* @param {number} fieldId Field ID.
[4173] Fix | Delete
*/
[4174] Fix | Delete
scrollPreviewToField( fieldId ) {
[4175] Fix | Delete
const $field = $( `#wpforms-field-${ fieldId }` ),
[4176] Fix | Delete
scrollTop = elements.$fieldsPreviewWrap.scrollTop(),
[4177] Fix | Delete
$layoutField = $field.closest( '.wpforms-field-layout' );
[4178] Fix | Delete
[4179] Fix | Delete
let fieldPosition = $field.position().top;
[4180] Fix | Delete
[4181] Fix | Delete
if ( $layoutField.length ) {
[4182] Fix | Delete
fieldPosition = $layoutField.position().top + fieldPosition + 20;
[4183] Fix | Delete
}
[4184] Fix | Delete
[4185] Fix | Delete
const scrollAmount = fieldPosition > scrollTop ? fieldPosition - scrollTop : fieldPosition + scrollTop;
[4186] Fix | Delete
[4187] Fix | Delete
elements.$fieldsPreviewWrap.scrollTop( scrollAmount );
[4188] Fix | Delete
},
[4189] Fix | Delete
[4190] Fix | Delete
/**
[4191] Fix | Delete
* Update CAPTCHA form setting.
[4192] Fix | Delete
*
[4193] Fix | Delete
* @since 1.6.4
[4194] Fix | Delete
*
[4195] Fix | Delete
* @return {Object} jqXHR.
[4196] Fix | Delete
*/
[4197] Fix | Delete
captchaUpdate() {
[4198] Fix | Delete
const data = {
[4199] Fix | Delete
action: 'wpforms_update_field_captcha',
[4200] Fix | Delete
id: s.formID,
[4201] Fix | Delete
nonce: wpforms_builder.nonce,
[4202] Fix | Delete
};
[4203] Fix | Delete
[4204] Fix | Delete
return $.post( wpforms_builder.ajax_url, data, function( res ) {
[4205] Fix | Delete
if ( res.success ) {
[4206] Fix | Delete
const args = {
[4207] Fix | Delete
title: false,
[4208] Fix | Delete
content: false,
[4209] Fix | Delete
icon: 'fa fa-exclamation-circle',
[4210] Fix | Delete
type: 'orange',
[4211] Fix | Delete
boxWidth: '450px',
[4212] Fix | Delete
buttons: {
[4213] Fix | Delete
confirm: {
[4214] Fix | Delete
text: wpforms_builder.ok,
[4215] Fix | Delete
btnClass: 'btn-confirm',
[4216] Fix | Delete
keys: [ 'enter' ],
[4217] Fix | Delete
},
[4218] Fix | Delete
},
[4219] Fix | Delete
},
[4220] Fix | Delete
$enableCheckbox = $( '#wpforms-panel-field-settings-recaptcha' );
[4221] Fix | Delete
let caseName = res.data.current;
[4222] Fix | Delete
[4223] Fix | Delete
$enableCheckbox.data( 'provider', res.data.provider );
[4224] Fix | Delete
[4225] Fix | Delete
// Possible cases:
[4226] Fix | Delete
//
[4227] Fix | Delete
// not_configured - IF CAPTCHA is not configured in the WPForms plugin settings
[4228] Fix | Delete
// configured_not_enabled - IF CAPTCHA is configured in WPForms plugin settings, but wasn't set in form settings
[4229] Fix | Delete
// configured_enabled - IF CAPTCHA is configured in WPForms plugin and form settings
[4230] Fix | Delete
if ( 'configured_not_enabled' === caseName || 'configured_enabled' === caseName ) {
[4231] Fix | Delete
// Get a correct case name.
[4232] Fix | Delete
caseName = $enableCheckbox.prop( 'checked' ) ? 'configured_enabled' : 'configured_not_enabled';
[4233] Fix | Delete
[4234] Fix | Delete
// Check/uncheck a `CAPTCHA` checkbox in form setting.
[4235] Fix | Delete
args.buttons.confirm.action = function() {
[4236] Fix | Delete
$enableCheckbox.prop( 'checked', ( 'configured_not_enabled' === caseName ) ).trigger( 'change' );
[4237] Fix | Delete
};
[4238] Fix | Delete
}
[4239] Fix | Delete
[4240] Fix | Delete
args.title = res.data.cases[ caseName ].title;
[4241] Fix | Delete
args.content = res.data.cases[ caseName ].content;
[4242] Fix | Delete
[4243] Fix | Delete
// Do you need a Cancel button?
[4244] Fix | Delete
if ( res.data.cases[ caseName ].cancel ) {
[4245] Fix | Delete
args.buttons.cancel = {
[4246] Fix | Delete
text: wpforms_builder.cancel,
[4247] Fix | Delete
keys: [ 'esc' ],
[4248] Fix | Delete
};
[4249] Fix | Delete
}
[4250] Fix | Delete
[4251] Fix | Delete
// Call a Confirm modal.
[4252] Fix | Delete
$.confirm( args );
[4253] Fix | Delete
} else {
[4254] Fix | Delete
// eslint-disable-next-line no-console
[4255] Fix | Delete
console.log( res );
[4256] Fix | Delete
}
[4257] Fix | Delete
} ).fail( function( xhr, textStatus, e ) { // eslint-disable-line no-unused-vars
[4258] Fix | Delete
// eslint-disable-next-line no-console
[4259] Fix | Delete
console.log( xhr.responseText );
[4260] Fix | Delete
} );
[4261] Fix | Delete
},
[4262] Fix | Delete
[4263] Fix | Delete
/**
[4264] Fix | Delete
* Disable drag & drop.
[4265] Fix | Delete
*
[4266] Fix | Delete
* @since 1.7.1
[4267] Fix | Delete
* @since 1.7.7 Deprecated.
[4268] Fix | Delete
*
[4269] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.DragFields.disableDragAndDrop()` instead.
[4270] Fix | Delete
*/
[4271] Fix | Delete
disableDragAndDrop() {
[4272] Fix | Delete
// eslint-disable-next-line no-console
[4273] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.disableDragAndDrop()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.disableDragAndDrop()" function instead!' );
[4274] Fix | Delete
[4275] Fix | Delete
WPForms.Admin.Builder.DragFields.disableDragAndDrop();
[4276] Fix | Delete
},
[4277] Fix | Delete
[4278] Fix | Delete
/**
[4279] Fix | Delete
* Enable drag & drop.
[4280] Fix | Delete
*
[4281] Fix | Delete
* @since 1.7.1
[4282] Fix | Delete
* @since 1.7.7 Deprecated.
[4283] Fix | Delete
*
[4284] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.DragFields.enableDragAndDrop()` instead.
[4285] Fix | Delete
*/
[4286] Fix | Delete
enableDragAndDrop() {
[4287] Fix | Delete
// eslint-disable-next-line no-console
[4288] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.enableDragAndDrop()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.enableDragAndDrop()" function instead!' );
[4289] Fix | Delete
[4290] Fix | Delete
WPForms.Admin.Builder.DragFields.enableDragAndDrop();
[4291] Fix | Delete
},
[4292] Fix | Delete
[4293] Fix | Delete
/**
[4294] Fix | Delete
* Disable Preview, Embed, Save form actions and Form Builder exit button.
[4295] Fix | Delete
*
[4296] Fix | Delete
* @since 1.7.4
[4297] Fix | Delete
*/
[4298] Fix | Delete
disableFormActions() {
[4299] Fix | Delete
$.each(
[4300] Fix | Delete
[
[4301] Fix | Delete
elements.$previewButton,
[4302] Fix | Delete
elements.$embedButton,
[4303] Fix | Delete
elements.$saveButton,
[4304] Fix | Delete
elements.$exitButton,
[4305] Fix | Delete
],
[4306] Fix | Delete
function( _index, button ) {
[4307] Fix | Delete
button.prop( 'disabled', true ).addClass( 'wpforms-disabled' );
[4308] Fix | Delete
}
[4309] Fix | Delete
);
[4310] Fix | Delete
},
[4311] Fix | Delete
[4312] Fix | Delete
/**
[4313] Fix | Delete
* Enable Preview, Embed, Save form actions and Form Builder exit button.
[4314] Fix | Delete
*
[4315] Fix | Delete
* @since 1.7.4
[4316] Fix | Delete
*/
[4317] Fix | Delete
enableFormActions() {
[4318] Fix | Delete
$.each(
[4319] Fix | Delete
[
[4320] Fix | Delete
elements.$previewButton,
[4321] Fix | Delete
elements.$embedButton,
[4322] Fix | Delete
elements.$saveButton,
[4323] Fix | Delete
elements.$exitButton,
[4324] Fix | Delete
],
[4325] Fix | Delete
function( _index, button ) {
[4326] Fix | Delete
button.prop( 'disabled', false ).removeClass( 'wpforms-disabled' );
[4327] Fix | Delete
}
[4328] Fix | Delete
);
[4329] Fix | Delete
},
[4330] Fix | Delete
[4331] Fix | Delete
/**
[4332] Fix | Delete
* Sortable fields in the builder form preview area.
[4333] Fix | Delete
*
[4334] Fix | Delete
* @since 1.0.0
[4335] Fix | Delete
* @since 1.7.7 Deprecated.
[4336] Fix | Delete
*
[4337] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.DragFields.initSortableFields()` instead.
[4338] Fix | Delete
*/
[4339] Fix | Delete
fieldSortable() {
[4340] Fix | Delete
// eslint-disable-next-line no-console
[4341] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.fieldSortable()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.initSortableFields()" function instead!' );
[4342] Fix | Delete
[4343] Fix | Delete
WPForms.Admin.Builder.DragFields.initSortableFields();
[4344] Fix | Delete
},
[4345] Fix | Delete
[4346] Fix | Delete
/**
[4347] Fix | Delete
* Show popup in case if field is not draggable, and cancel moving.
[4348] Fix | Delete
*
[4349] Fix | Delete
* @since 1.7.5
[4350] Fix | Delete
* @since 1.7.6 The showPopUp parameter added.
[4351] Fix | Delete
* @since 1.7.7 Deprecated.
[4352] Fix | Delete
*
[4353] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.DragFields.fieldDragDisable()` instead.
[4354] Fix | Delete
*
[4355] Fix | Delete
* @param {jQuery} $field A field or list of fields.
[4356] Fix | Delete
* @param {boolean} showPopUp Whether the pop-up should be displayed on dragging attempt.
[4357] Fix | Delete
*/
[4358] Fix | Delete
fieldDragDisable( $field, showPopUp = true ) {
[4359] Fix | Delete
// eslint-disable-next-line no-console
[4360] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.fieldDragDisable()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.fieldDragDisable()" function instead!' );
[4361] Fix | Delete
[4362] Fix | Delete
WPForms.Admin.Builder.DragFields.fieldDragDisable( $field, showPopUp );
[4363] Fix | Delete
},
[4364] Fix | Delete
[4365] Fix | Delete
/**
[4366] Fix | Delete
* Allow field dragging.
[4367] Fix | Delete
*
[4368] Fix | Delete
* @since 1.7.5
[4369] Fix | Delete
* @since 1.7.7 Deprecated.
[4370] Fix | Delete
*
[4371] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.DragFields.fieldDragEnable()` instead.
[4372] Fix | Delete
*
[4373] Fix | Delete
* @param {jQuery} $field A field or list of fields.
[4374] Fix | Delete
*/
[4375] Fix | Delete
fieldDragEnable( $field ) {
[4376] Fix | Delete
// eslint-disable-next-line no-console
[4377] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.fieldDragEnable()" has been deprecated, please use the new "WPForms.Admin.Builder.DragFields.fieldDragEnable()" function instead!' );
[4378] Fix | Delete
[4379] Fix | Delete
WPForms.Admin.Builder.DragFields.fieldDragEnable( $field );
[4380] Fix | Delete
},
[4381] Fix | Delete
[4382] Fix | Delete
/**
[4383] Fix | Delete
* Add new field choice.
[4384] Fix | Delete
*
[4385] Fix | Delete
* @since 1.0.0
[4386] Fix | Delete
*
[4387] Fix | Delete
* @param {Event} event Event.
[4388] Fix | Delete
* @param {Element} el Element.
[4389] Fix | Delete
*/
[4390] Fix | Delete
fieldChoiceAdd( event, el ) {
[4391] Fix | Delete
event.preventDefault();
[4392] Fix | Delete
[4393] Fix | Delete
const $this = $( el ),
[4394] Fix | Delete
$parent = $this.parent(),
[4395] Fix | Delete
checked = $parent.find( 'input.default' ).is( ':checked' ),
[4396] Fix | Delete
fieldID = $this.closest( '.wpforms-field-option-row-choices' ).data( 'field-id' );
[4397] Fix | Delete
let id = $parent.parent().attr( 'data-next-id' );
[4398] Fix | Delete
const type = $parent.parent().data( 'field-type' ),
[4399] Fix | Delete
$choice = $parent.clone().insertAfter( $parent );
[4400] Fix | Delete
[4401] Fix | Delete
$choice.attr( 'data-key', id );
[4402] Fix | Delete
$choice.find( 'input.label' ).val( '' ).attr( 'name', 'fields[' + fieldID + '][choices][' + id + '][label]' );
[4403] Fix | Delete
$choice.find( 'input.value' ).val( '' ).attr( 'name', 'fields[' + fieldID + '][choices][' + id + '][value]' );
[4404] Fix | Delete
$choice.find( '.wpforms-image-upload input.source' ).val( '' ).attr( 'name', 'fields[' + fieldID + '][choices][' + id + '][image]' );
[4405] Fix | Delete
$choice.find( '.wpforms-icon-select input.source-icon' ).val( wpforms_builder.icon_choices.default_icon ).attr( 'name', 'fields[' + fieldID + '][choices][' + id + '][icon]' );
[4406] Fix | Delete
$choice.find( '.wpforms-icon-select input.source-icon-style' ).val( wpforms_builder.icon_choices.default_icon_style ).attr( 'name', 'fields[' + fieldID + '][choices][' + id + '][icon_style]' );
[4407] Fix | Delete
$choice.find( '.wpforms-icon-select .ic-fa-preview' ).removeClass().addClass( 'ic-fa-preview ic-fa-' + wpforms_builder.icon_choices.default_icon_style + ' ic-fa-' + wpforms_builder.icon_choices.default_icon );
[4408] Fix | Delete
$choice.find( '.wpforms-icon-select .ic-fa-preview + span' ).text( wpforms_builder.icon_choices.default_icon );
[4409] Fix | Delete
$choice.find( 'input.default' ).attr( 'name', 'fields[' + fieldID + '][choices][' + id + '][default]' ).prop( 'checked', false );
[4410] Fix | Delete
$choice.find( '.preview' ).empty();
[4411] Fix | Delete
$choice.find( '.wpforms-image-upload-add' ).show();
[4412] Fix | Delete
$choice.find( '.wpforms-money-input' ).trigger( 'focusout' );
[4413] Fix | Delete
[4414] Fix | Delete
if ( checked === true ) {
[4415] Fix | Delete
$parent.find( 'input.default' ).prop( 'checked', true );
[4416] Fix | Delete
}
[4417] Fix | Delete
[4418] Fix | Delete
id++;
[4419] Fix | Delete
[4420] Fix | Delete
$parent.parent().attr( 'data-next-id', id );
[4421] Fix | Delete
$builder.trigger( 'wpformsFieldChoiceAdd', [ fieldID ] );
[4422] Fix | Delete
app.fieldChoiceUpdate( type, fieldID );
[4423] Fix | Delete
},
[4424] Fix | Delete
[4425] Fix | Delete
/**
[4426] Fix | Delete
* Delete field choice.
[4427] Fix | Delete
*
[4428] Fix | Delete
* @since 1.0.0
[4429] Fix | Delete
*
[4430] Fix | Delete
* @param {Event} e Event.
[4431] Fix | Delete
* @param {Element} el Element.
[4432] Fix | Delete
*/
[4433] Fix | Delete
fieldChoiceDelete( e, el ) {
[4434] Fix | Delete
e.preventDefault();
[4435] Fix | Delete
[4436] Fix | Delete
const $this = $( el ),
[4437] Fix | Delete
$list = $this.parent().parent(),
[4438] Fix | Delete
total = $list.find( 'li' ).length,
[4439] Fix | Delete
fieldData = {
[4440] Fix | Delete
id: $list.data( 'field-id' ),
[4441] Fix | Delete
choiceId: $this.closest( 'li' ).data( 'key' ),
[4442] Fix | Delete
message: '<strong>' + wpforms_builder.delete_choice_confirm + '</strong>',
[4443] Fix | Delete
trigger: false,
[4444] Fix | Delete
};
[4445] Fix | Delete
[4446] Fix | Delete
$builder.trigger( 'wpformsBeforeFieldDeleteAlert', [ fieldData ] );
[4447] Fix | Delete
[4448] Fix | Delete
if ( total === 1 ) {
[4449] Fix | Delete
app.fieldChoiceDeleteAlert();
[4450] Fix | Delete
} else {
[4451] Fix | Delete
const deleteChoice = function() {
[4452] Fix | Delete
$this.parent().remove();
[4453] Fix | Delete
app.fieldChoiceUpdate( $list.data( 'field-type' ), $list.data( 'field-id' ) );
[4454] Fix | Delete
$builder.trigger( 'wpformsFieldChoiceDelete', [ $list.data( 'field-id' ) ] );
[4455] Fix | Delete
};
[4456] Fix | Delete
[4457] Fix | Delete
if ( ! fieldData.trigger ) {
[4458] Fix | Delete
deleteChoice();
[4459] Fix | Delete
[4460] Fix | Delete
return;
[4461] Fix | Delete
}
[4462] Fix | Delete
[4463] Fix | Delete
$.confirm( {
[4464] Fix | Delete
title: false,
[4465] Fix | Delete
content: fieldData.message,
[4466] Fix | Delete
icon: 'fa fa-exclamation-circle',
[4467] Fix | Delete
type: 'orange',
[4468] Fix | Delete
buttons: {
[4469] Fix | Delete
confirm: {
[4470] Fix | Delete
text: wpforms_builder.ok,
[4471] Fix | Delete
btnClass: 'btn-confirm',
[4472] Fix | Delete
keys: [ 'enter' ],
[4473] Fix | Delete
action() {
[4474] Fix | Delete
deleteChoice();
[4475] Fix | Delete
},
[4476] Fix | Delete
},
[4477] Fix | Delete
cancel: {
[4478] Fix | Delete
text: wpforms_builder.cancel,
[4479] Fix | Delete
},
[4480] Fix | Delete
},
[4481] Fix | Delete
} );
[4482] Fix | Delete
}
[4483] Fix | Delete
},
[4484] Fix | Delete
[4485] Fix | Delete
/**
[4486] Fix | Delete
* Field choice delete error alert.
[4487] Fix | Delete
*
[4488] Fix | Delete
* @since 1.6.7
[4489] Fix | Delete
*/
[4490] Fix | Delete
fieldChoiceDeleteAlert() {
[4491] Fix | Delete
$.alert( {
[4492] Fix | Delete
title: false,
[4493] Fix | Delete
content: wpforms_builder.error_choice,
[4494] Fix | Delete
icon: 'fa fa-info-circle',
[4495] Fix | Delete
type: 'blue',
[4496] Fix | Delete
buttons: {
[4497] Fix | Delete
confirm: {
[4498] Fix | Delete
text: wpforms_builder.ok,
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function