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
? $label.after( smartTagList )
[7500] Fix | Delete
: $el.after( smartTagList );
[7501] Fix | Delete
[7502] Fix | Delete
$el.find( 'span' ).text( wpforms_builder.smart_tags_hide );
[7503] Fix | Delete
[7504] Fix | Delete
$wrapper.find( '.smart-tags-list-display' ).slideDown( '', function() {
[7505] Fix | Delete
$el.addClass( 'smart-tag-showing' );
[7506] Fix | Delete
$wrapper.removeClass( 'smart-tags-toggling' );
[7507] Fix | Delete
} );
[7508] Fix | Delete
},
[7509] Fix | Delete
[7510] Fix | Delete
/**
[7511] Fix | Delete
* Get Smart Tag list markup.
[7512] Fix | Delete
*
[7513] Fix | Delete
* @since 1.6.9
[7514] Fix | Delete
*
[7515] Fix | Delete
* @param {jQuery} $el Toggle element.
[7516] Fix | Delete
* @param {boolean} isFieldOption Is a field option.
[7517] Fix | Delete
*
[7518] Fix | Delete
* @return {string} Smart Tags list markup.
[7519] Fix | Delete
*/
[7520] Fix | Delete
getSmartTagsList( $el, isFieldOption ) {
[7521] Fix | Delete
let smartTagList;
[7522] Fix | Delete
[7523] Fix | Delete
smartTagList = '<ul class="smart-tags-list-display unfoldable-cont">';
[7524] Fix | Delete
smartTagList += app.getSmartTagsListFieldsElements( $el );
[7525] Fix | Delete
smartTagList += app.getSmartTagsListOtherElements( $el, isFieldOption );
[7526] Fix | Delete
smartTagList += '</ul>';
[7527] Fix | Delete
[7528] Fix | Delete
return smartTagList;
[7529] Fix | Delete
},
[7530] Fix | Delete
[7531] Fix | Delete
/**
[7532] Fix | Delete
* Get Smart Tag fields elements markup.
[7533] Fix | Delete
*
[7534] Fix | Delete
* @since 1.6.9
[7535] Fix | Delete
*
[7536] Fix | Delete
* @param {jQuery} $el Toggle element.
[7537] Fix | Delete
*
[7538] Fix | Delete
* @return {string} Smart Tags list elements markup.
[7539] Fix | Delete
*/
[7540] Fix | Delete
getSmartTagsListFieldsElements( $el ) {
[7541] Fix | Delete
const type = $el.data( 'type' );
[7542] Fix | Delete
[7543] Fix | Delete
if ( ! [ 'fields', 'all' ].includes( type ) ) {
[7544] Fix | Delete
return '';
[7545] Fix | Delete
}
[7546] Fix | Delete
[7547] Fix | Delete
const fields = app.getSmartTagsFields( $el );
[7548] Fix | Delete
[7549] Fix | Delete
if ( ! fields ) {
[7550] Fix | Delete
return '<li class="heading">' + wpforms_builder.fields_unavailable + '</li>';
[7551] Fix | Delete
}
[7552] Fix | Delete
[7553] Fix | Delete
let smartTagListElements = '';
[7554] Fix | Delete
[7555] Fix | Delete
smartTagListElements += '<li class="heading">' + wpforms_builder.fields_available + '</li>';
[7556] Fix | Delete
[7557] Fix | Delete
for ( const fieldKey in wpf.orders.fields ) {
[7558] Fix | Delete
const fieldId = wpf.orders.fields[ fieldKey ];
[7559] Fix | Delete
[7560] Fix | Delete
if ( ! fields[ fieldId ] ) {
[7561] Fix | Delete
continue;
[7562] Fix | Delete
}
[7563] Fix | Delete
[7564] Fix | Delete
smartTagListElements += app.getSmartTagsListFieldsElement( fields[ fieldId ] );
[7565] Fix | Delete
}
[7566] Fix | Delete
[7567] Fix | Delete
return smartTagListElements;
[7568] Fix | Delete
},
[7569] Fix | Delete
[7570] Fix | Delete
/**
[7571] Fix | Delete
* Get fields that possible to create smart tag.
[7572] Fix | Delete
*
[7573] Fix | Delete
* @since 1.6.9
[7574] Fix | Delete
*
[7575] Fix | Delete
* @param {jQuery} $el Toggle element.
[7576] Fix | Delete
*
[7577] Fix | Delete
* @return {Array} Fields for smart tags.
[7578] Fix | Delete
*/
[7579] Fix | Delete
getSmartTagsFields( $el ) {
[7580] Fix | Delete
const allowed = $el.data( 'fields' );
[7581] Fix | Delete
const isAllowedRepeater = $el.data( 'allow-repeated-fields' );
[7582] Fix | Delete
const allowedFields = allowed ? allowed.split( ',' ) : undefined;
[7583] Fix | Delete
[7584] Fix | Delete
return wpf.getFields( allowedFields, true, isAllowedRepeater );
[7585] Fix | Delete
},
[7586] Fix | Delete
[7587] Fix | Delete
/**
[7588] Fix | Delete
* Get field markup for the Smart Tags list.
[7589] Fix | Delete
*
[7590] Fix | Delete
* @since 1.6.9
[7591] Fix | Delete
*
[7592] Fix | Delete
* @param {Object} field A field.
[7593] Fix | Delete
*
[7594] Fix | Delete
* @return {string} Smart Tags field markup.
[7595] Fix | Delete
*/
[7596] Fix | Delete
getSmartTagsListFieldsElement( field ) {
[7597] Fix | Delete
const label = field.label
[7598] Fix | Delete
? wpf.encodeHTMLEntities( wpf.sanitizeHTML( field.label ) )
[7599] Fix | Delete
: wpforms_builder.field + ' #' + field.id;
[7600] Fix | Delete
[7601] Fix | Delete
return '<li><a href="#" data-type="field" data-meta=\'' + field.id + '\'>' + label + '</a></li>';
[7602] Fix | Delete
},
[7603] Fix | Delete
[7604] Fix | Delete
/**
[7605] Fix | Delete
* Get Smart Tag other elements markup.
[7606] Fix | Delete
*
[7607] Fix | Delete
* @since 1.6.9
[7608] Fix | Delete
*
[7609] Fix | Delete
* @param {jQuery} $el Toggle element.
[7610] Fix | Delete
* @param {boolean} isFieldOption Is a field option.
[7611] Fix | Delete
*
[7612] Fix | Delete
* @return {string} Smart Tags list elements markup.
[7613] Fix | Delete
*/
[7614] Fix | Delete
getSmartTagsListOtherElements( $el, isFieldOption ) {
[7615] Fix | Delete
const type = $el.data( 'type' );
[7616] Fix | Delete
let smartTagListElements;
[7617] Fix | Delete
[7618] Fix | Delete
if ( type !== 'other' && type !== 'all' ) {
[7619] Fix | Delete
return '';
[7620] Fix | Delete
}
[7621] Fix | Delete
[7622] Fix | Delete
smartTagListElements = '<li class="heading">' + wpforms_builder.other + '</li>';
[7623] Fix | Delete
[7624] Fix | Delete
for ( const smartTagKey in wpforms_builder.smart_tags ) {
[7625] Fix | Delete
if ( isFieldOption && wpforms_builder.smart_tags_disabled_for_fields.indexOf( smartTagKey ) > -1 ) {
[7626] Fix | Delete
continue;
[7627] Fix | Delete
}
[7628] Fix | Delete
[7629] Fix | Delete
smartTagListElements += '<li><a href="#" data-type="other" data-meta=\'' + smartTagKey + '\'>' + wpforms_builder.smart_tags[ smartTagKey ] + '</a></li>';
[7630] Fix | Delete
}
[7631] Fix | Delete
[7632] Fix | Delete
return smartTagListElements;
[7633] Fix | Delete
},
[7634] Fix | Delete
[7635] Fix | Delete
/**
[7636] Fix | Delete
* Smart Tag insert.
[7637] Fix | Delete
*
[7638] Fix | Delete
* @since 1.0.1
[7639] Fix | Delete
* @since 1.6.9 TinyMCE compatibility.
[7640] Fix | Delete
*
[7641] Fix | Delete
* @param {Event} e Event.
[7642] Fix | Delete
*/
[7643] Fix | Delete
smartTagInsert( e ) { // eslint-disable-line complexity
[7644] Fix | Delete
e.preventDefault();
[7645] Fix | Delete
[7646] Fix | Delete
const $this = $( this ),
[7647] Fix | Delete
$list = $this.closest( '.smart-tags-list-display' ),
[7648] Fix | Delete
$wrapper = $list.closest( '.wpforms-panel-field,.wpforms-field-option-row' ),
[7649] Fix | Delete
$toggle = $wrapper.find( '.toggle-smart-tag-display' ),
[7650] Fix | Delete
$input = $wrapper.find( 'input[type=text], textarea' ),
[7651] Fix | Delete
meta = $this.data( 'meta' ),
[7652] Fix | Delete
type = $this.data( 'type' );
[7653] Fix | Delete
let smartTag = type === 'field' ? '{field_id="' + meta + '"}' : '{' + meta + '}',
[7654] Fix | Delete
editor;
[7655] Fix | Delete
[7656] Fix | Delete
if ( typeof tinyMCE !== 'undefined' ) {
[7657] Fix | Delete
editor = tinyMCE.get( $input.prop( 'id' ) );
[7658] Fix | Delete
[7659] Fix | Delete
if ( editor && ! editor.hasFocus() ) {
[7660] Fix | Delete
editor.focus( true );
[7661] Fix | Delete
}
[7662] Fix | Delete
}
[7663] Fix | Delete
[7664] Fix | Delete
if ( editor && ! editor.isHidden() ) {
[7665] Fix | Delete
editor.insertContent( smartTag );
[7666] Fix | Delete
} else {
[7667] Fix | Delete
smartTag = ' ' + smartTag + ' ';
[7668] Fix | Delete
[7669] Fix | Delete
$input.insertAtCaret( smartTag );
[7670] Fix | Delete
[7671] Fix | Delete
// Remove redundant spaces after wrapping smartTag into spaces.
[7672] Fix | Delete
$input.val( $input.val().trim().replace( ' ', ' ' ) );
[7673] Fix | Delete
$input.trigger( 'focus' ).trigger( 'input' );
[7674] Fix | Delete
}
[7675] Fix | Delete
[7676] Fix | Delete
// Remove the list, all done!
[7677] Fix | Delete
$list.slideUp( '', function() {
[7678] Fix | Delete
$list.remove();
[7679] Fix | Delete
} );
[7680] Fix | Delete
[7681] Fix | Delete
$toggle.find( 'span' ).text( wpforms_builder.smart_tags_show );
[7682] Fix | Delete
$wrapper.find( '.toggle-smart-tag-display' ).removeClass( 'smart-tag-showing' );
[7683] Fix | Delete
},
[7684] Fix | Delete
[7685] Fix | Delete
/**
[7686] Fix | Delete
* Field map table - Delete row.
[7687] Fix | Delete
*
[7688] Fix | Delete
* @since 1.2.0
[7689] Fix | Delete
* @since 1.6.1.2 Registered `wpformsFieldMapTableDeletedRow` trigger.
[7690] Fix | Delete
*
[7691] Fix | Delete
* @param {Event} e Event.
[7692] Fix | Delete
* @param {Element} el Element.
[7693] Fix | Delete
*/
[7694] Fix | Delete
fieldMapTableDeleteRow( e, el ) {
[7695] Fix | Delete
const $this = $( el ),
[7696] Fix | Delete
$row = $this.closest( 'tr' ),
[7697] Fix | Delete
$table = $this.closest( 'table' ),
[7698] Fix | Delete
$block = $row.closest( '.wpforms-builder-settings-block' ),
[7699] Fix | Delete
total = $table.find( 'tr' ).length;
[7700] Fix | Delete
[7701] Fix | Delete
if ( total > '1' ) {
[7702] Fix | Delete
$row.remove();
[7703] Fix | Delete
[7704] Fix | Delete
$builder.trigger( 'wpformsFieldMapTableDeletedRow', [ $block ] );
[7705] Fix | Delete
}
[7706] Fix | Delete
},
[7707] Fix | Delete
[7708] Fix | Delete
/**
[7709] Fix | Delete
* Field map table - Add row.
[7710] Fix | Delete
*
[7711] Fix | Delete
* @since 1.2.0
[7712] Fix | Delete
* @since 1.6.1.2 Registered `wpformsFieldMapTableAddedRow` trigger.
[7713] Fix | Delete
*
[7714] Fix | Delete
* @param {Event} e Event.
[7715] Fix | Delete
* @param {Element} el Element.
[7716] Fix | Delete
*/
[7717] Fix | Delete
fieldMapTableAddRow( e, el ) {
[7718] Fix | Delete
const $this = $( el ),
[7719] Fix | Delete
$row = $this.closest( 'tr' ),
[7720] Fix | Delete
$block = $row.closest( '.wpforms-builder-settings-block' ),
[7721] Fix | Delete
choice = $row.clone().insertAfter( $row );
[7722] Fix | Delete
[7723] Fix | Delete
choice.find( 'input' ).val( '' );
[7724] Fix | Delete
choice.find( 'select :selected' ).prop( 'selected', false );
[7725] Fix | Delete
choice.find( '.key-destination' ).attr( 'name', '' );
[7726] Fix | Delete
[7727] Fix | Delete
$builder.trigger( 'wpformsFieldMapTableAddedRow', [ $block, choice ] );
[7728] Fix | Delete
},
[7729] Fix | Delete
[7730] Fix | Delete
/**
[7731] Fix | Delete
* Update field mapped select items on form updates.
[7732] Fix | Delete
*
[7733] Fix | Delete
* @since 1.2.0
[7734] Fix | Delete
* @since 1.6.1.2 Registered `wpformsFieldSelectMapped` trigger.
[7735] Fix | Delete
*
[7736] Fix | Delete
* @param {Event} e Event.
[7737] Fix | Delete
* @param {Object} fields Fields.
[7738] Fix | Delete
*/
[7739] Fix | Delete
fieldMapSelect( e, fields ) { // eslint-disable-line max-lines-per-function
[7740] Fix | Delete
$( '.wpforms-field-map-select' ).each( function( index, el ) { // eslint-disable-line complexity, no-unused-vars
[7741] Fix | Delete
const $this = $( this );
[7742] Fix | Delete
let allowedFields = $this.data( 'field-map-allowed' ),
[7743] Fix | Delete
placeholder = $this.data( 'field-map-placeholder' );
[7744] Fix | Delete
[7745] Fix | Delete
// Check if custom placeholder was provided.
[7746] Fix | Delete
if ( typeof placeholder === 'undefined' || ! placeholder ) {
[7747] Fix | Delete
placeholder = wpforms_builder.select_field;
[7748] Fix | Delete
}
[7749] Fix | Delete
[7750] Fix | Delete
// If allowed, fields are not defined, bail.
[7751] Fix | Delete
if ( typeof allowedFields !== 'undefined' && allowedFields ) {
[7752] Fix | Delete
allowedFields = allowedFields.split( ' ' );
[7753] Fix | Delete
} else {
[7754] Fix | Delete
return;
[7755] Fix | Delete
}
[7756] Fix | Delete
[7757] Fix | Delete
const selected = $this.find( 'option:selected' ).val();
[7758] Fix | Delete
[7759] Fix | Delete
// Reset select and add a placeholder option.
[7760] Fix | Delete
$this.empty().append( $( '<option>', { value: '', text: placeholder } ) );
[7761] Fix | Delete
[7762] Fix | Delete
// Loop through the current fields, if we have fields for the form.
[7763] Fix | Delete
if ( fields && ! $.isEmptyObject( fields ) ) {
[7764] Fix | Delete
for ( const key in wpf.orders.fields ) {
[7765] Fix | Delete
if ( ! Object.prototype.hasOwnProperty.call( wpf.orders.fields, key ) ) {
[7766] Fix | Delete
continue;
[7767] Fix | Delete
}
[7768] Fix | Delete
[7769] Fix | Delete
const fieldID = wpf.orders.fields[ key ];
[7770] Fix | Delete
let label = '';
[7771] Fix | Delete
[7772] Fix | Delete
if ( ! fields[ fieldID ] ) {
[7773] Fix | Delete
continue;
[7774] Fix | Delete
}
[7775] Fix | Delete
[7776] Fix | Delete
// Prepare the label.
[7777] Fix | Delete
if ( typeof fields[ fieldID ].label !== 'undefined' && fields[ fieldID ].label.toString().trim() !== '' ) {
[7778] Fix | Delete
label = wpf.sanitizeHTML( fields[ fieldID ].label.toString().trim() );
[7779] Fix | Delete
} else {
[7780] Fix | Delete
label = wpforms_builder.field + ' #' + fieldID;
[7781] Fix | Delete
}
[7782] Fix | Delete
[7783] Fix | Delete
// Add to select if it is a field type allowed.
[7784] Fix | Delete
if ( $.inArray( fields[ fieldID ].type, allowedFields ) >= 0 || $.inArray( 'all-fields', allowedFields ) >= 0 ) {
[7785] Fix | Delete
$this.append( $( '<option>', { value: fields[ fieldID ].id, text: label } ) );
[7786] Fix | Delete
}
[7787] Fix | Delete
}
[7788] Fix | Delete
}
[7789] Fix | Delete
[7790] Fix | Delete
// Restore previous value if found.
[7791] Fix | Delete
if ( selected ) {
[7792] Fix | Delete
$this.find( 'option[value="' + selected + '"]' ).prop( 'selected', true );
[7793] Fix | Delete
}
[7794] Fix | Delete
[7795] Fix | Delete
// Add a "Custom Value" option if it is supported.
[7796] Fix | Delete
const customValueSupport = $this.data( 'custom-value-support' );
[7797] Fix | Delete
[7798] Fix | Delete
if ( typeof customValueSupport === 'boolean' && customValueSupport ) {
[7799] Fix | Delete
$this.append(
[7800] Fix | Delete
$( '<option>', {
[7801] Fix | Delete
value: 'custom_value',
[7802] Fix | Delete
text: wpforms_builder.add_custom_value_label,
[7803] Fix | Delete
class: 'wpforms-field-map-option-custom-value',
[7804] Fix | Delete
} )
[7805] Fix | Delete
);
[7806] Fix | Delete
}
[7807] Fix | Delete
[7808] Fix | Delete
$builder.trigger( 'wpformsFieldSelectMapped', [ $this ] );
[7809] Fix | Delete
} );
[7810] Fix | Delete
},
[7811] Fix | Delete
[7812] Fix | Delete
/**
[7813] Fix | Delete
* Validate email smart tags in Notifications fields.
[7814] Fix | Delete
*
[7815] Fix | Delete
* @param {Object} $el Input field to check the value for.
[7816] Fix | Delete
*
[7817] Fix | Delete
* @since 1.4.9
[7818] Fix | Delete
*/
[7819] Fix | Delete
validateEmailSmartTags( $el ) {
[7820] Fix | Delete
let val = $el.val();
[7821] Fix | Delete
[7822] Fix | Delete
if ( ! val ) {
[7823] Fix | Delete
return;
[7824] Fix | Delete
}
[7825] Fix | Delete
[7826] Fix | Delete
// Turns '{email@domain.com}' into 'email@domain.com'.
[7827] Fix | Delete
// Email RegEx inspired by http://emailregex.com
[7828] Fix | Delete
val = val.replace( /{(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))}/g, function( x ) {
[7829] Fix | Delete
return x.slice( 1, -1 );
[7830] Fix | Delete
} );
[7831] Fix | Delete
[7832] Fix | Delete
$el.val( val );
[7833] Fix | Delete
},
[7834] Fix | Delete
[7835] Fix | Delete
/**
[7836] Fix | Delete
* Validate From Email in Notification block.
[7837] Fix | Delete
*
[7838] Fix | Delete
* @since 1.8.1
[7839] Fix | Delete
*/
[7840] Fix | Delete
validateFromEmail() {
[7841] Fix | Delete
const $field = $( this );
[7842] Fix | Delete
const value = $field.val().trim();
[7843] Fix | Delete
const $fieldWrapper = $field.parent();
[7844] Fix | Delete
const $warning = $fieldWrapper.find( '.wpforms-alert-warning-wide' );
[7845] Fix | Delete
const warningClass = 'wpforms-panel-field-warning';
[7846] Fix | Delete
[7847] Fix | Delete
const blockedSymbolsRegex = /[\s,;]/g;
[7848] Fix | Delete
[7849] Fix | Delete
if ( blockedSymbolsRegex.test( value ) ) {
[7850] Fix | Delete
$warning.remove();
[7851] Fix | Delete
$fieldWrapper.addClass( warningClass );
[7852] Fix | Delete
app.validationErrorNotificationPopup( wpforms_builder.allow_only_one_email );
[7853] Fix | Delete
[7854] Fix | Delete
return;
[7855] Fix | Delete
}
[7856] Fix | Delete
[7857] Fix | Delete
const data = {
[7858] Fix | Delete
form_id: s.formID, // eslint-disable-line camelcase
[7859] Fix | Delete
email: $field.val(),
[7860] Fix | Delete
nonce: wpforms_builder.nonce,
[7861] Fix | Delete
action: 'wpforms_builder_notification_from_email_validate',
[7862] Fix | Delete
};
[7863] Fix | Delete
[7864] Fix | Delete
$.post(
[7865] Fix | Delete
wpforms_builder.ajax_url, data, function( res ) {
[7866] Fix | Delete
if ( res.success ) {
[7867] Fix | Delete
$warning.remove();
[7868] Fix | Delete
$fieldWrapper.removeClass( warningClass );
[7869] Fix | Delete
[7870] Fix | Delete
return;
[7871] Fix | Delete
}
[7872] Fix | Delete
[7873] Fix | Delete
$fieldWrapper.addClass( warningClass );
[7874] Fix | Delete
[7875] Fix | Delete
if ( $warning.length ) {
[7876] Fix | Delete
$warning.replaceWith( res.data );
[7877] Fix | Delete
[7878] Fix | Delete
return;
[7879] Fix | Delete
}
[7880] Fix | Delete
[7881] Fix | Delete
$fieldWrapper.append( res.data );
[7882] Fix | Delete
} )
[7883] Fix | Delete
.fail( function( xhr, textStatus, e ) { // eslint-disable-line no-unused-vars
[7884] Fix | Delete
// eslint-disable-next-line no-console
[7885] Fix | Delete
console.log( xhr.responseText );
[7886] Fix | Delete
} );
[7887] Fix | Delete
},
[7888] Fix | Delete
[7889] Fix | Delete
//--------------------------------------------------------------------//
[7890] Fix | Delete
// Icon Choices
[7891] Fix | Delete
//--------------------------------------------------------------------//
[7892] Fix | Delete
[7893] Fix | Delete
/**
[7894] Fix | Delete
* Icon Choices component.
[7895] Fix | Delete
*
[7896] Fix | Delete
* @since 1.7.9
[7897] Fix | Delete
*/
[7898] Fix | Delete
iconChoices: {
[7899] Fix | Delete
[7900] Fix | Delete
/**
[7901] Fix | Delete
* Runtime component cache.
[7902] Fix | Delete
*
[7903] Fix | Delete
* Field "toggle": "Use icon choices" toggle that initiated the installation.
[7904] Fix | Delete
* Field "previousModal": Last open modal that may need to be closed.
[7905] Fix | Delete
*
[7906] Fix | Delete
* @since 1.7.9
[7907] Fix | Delete
*/
[7908] Fix | Delete
cache: {},
[7909] Fix | Delete
[7910] Fix | Delete
/**
[7911] Fix | Delete
* Component configuration settings.
[7912] Fix | Delete
*
[7913] Fix | Delete
* @since 1.7.9
[7914] Fix | Delete
*/
[7915] Fix | Delete
config: {
[7916] Fix | Delete
colorPropertyName: '--wpforms-icon-choices-color',
[7917] Fix | Delete
},
[7918] Fix | Delete
[7919] Fix | Delete
/**
[7920] Fix | Delete
* Initialize the component.
[7921] Fix | Delete
*
[7922] Fix | Delete
* @since 1.7.9
[7923] Fix | Delete
*/
[7924] Fix | Delete
init() {
[7925] Fix | Delete
// Extend jquery-confirm plugin with max-height support for the content area.
[7926] Fix | Delete
app.iconChoices.extendJqueryConfirm();
[7927] Fix | Delete
[7928] Fix | Delete
$builder.on( 'wpformsBuilderReady', function( event ) {
[7929] Fix | Delete
// If there are Icon Choices fields but the library is not installed - force install prompt.
[7930] Fix | Delete
if ( wpforms_builder.icon_choices.is_active && ! wpforms_builder.icon_choices.is_installed ) {
[7931] Fix | Delete
app.iconChoices.openInstallPromptModal( true );
[7932] Fix | Delete
[7933] Fix | Delete
// Prevent the Form Builder from getting ready (hold the loading state).
[7934] Fix | Delete
event.preventDefault();
[7935] Fix | Delete
}
[7936] Fix | Delete
} );
[7937] Fix | Delete
[7938] Fix | Delete
// Toggle Icon Choices on or off.
[7939] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-choices_icons input', app.iconChoices.toggleIconChoices );
[7940] Fix | Delete
[7941] Fix | Delete
// Change accent color.
[7942] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-choices_icons_color .wpforms-color-picker', app.iconChoices.changeIconsColor );
[7943] Fix | Delete
[7944] Fix | Delete
// Update field preview when option value is changed (style, size).
[7945] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-choices_icons_style select, .wpforms-field-option-row-choices_icons_size select', function() {
[7946] Fix | Delete
const fieldID = $( this ).parent().data( 'field-id' ),
[7947] Fix | Delete
fieldType = $( '#wpforms-field-option-' + fieldID ).find( '.wpforms-field-option-hidden-type' ).val();
[7948] Fix | Delete
[7949] Fix | Delete
app.fieldChoiceUpdate( fieldType, fieldID );
[7950] Fix | Delete
} );
[7951] Fix | Delete
[7952] Fix | Delete
// Open Icon Picker modal.
[7953] Fix | Delete
$builder.on( 'click', '.wpforms-field-option-row-choices .choices-list .wpforms-icon-select', app.iconChoices.openIconPickerModal );
[7954] Fix | Delete
},
[7955] Fix | Delete
[7956] Fix | Delete
/**
[7957] Fix | Delete
* Turn the feature on or off.
[7958] Fix | Delete
*
[7959] Fix | Delete
* @since 1.7.9
[7960] Fix | Delete
*/
[7961] Fix | Delete
toggleIconChoices() { // eslint-disable-line complexity
[7962] Fix | Delete
const $this = $( this ),
[7963] Fix | Delete
checked = $this.is( ':checked' );
[7964] Fix | Delete
[7965] Fix | Delete
// Check if a required icon library is installed.
[7966] Fix | Delete
if ( checked && ! wpforms_builder.icon_choices.is_installed ) {
[7967] Fix | Delete
app.iconChoices.cache.toggle = $this;
[7968] Fix | Delete
app.iconChoices.openInstallPromptModal();
[7969] Fix | Delete
[7970] Fix | Delete
return;
[7971] Fix | Delete
}
[7972] Fix | Delete
[7973] Fix | Delete
const fieldID = $this.closest( '.wpforms-field-option-row' ).data( 'field-id' );
[7974] Fix | Delete
const $fieldOptions = $( `#wpforms-field-option-${ fieldID }` ),
[7975] Fix | Delete
$imageChoices = $fieldOptions.find( `#wpforms-field-option-${ fieldID }-choices_images` ),
[7976] Fix | Delete
$choicesList = $fieldOptions.find( `#wpforms-field-option-row-${ fieldID }-choices ul` );
[7977] Fix | Delete
[7978] Fix | Delete
// Turn Image Choice off.
[7979] Fix | Delete
if ( checked && $imageChoices.is( ':checked' ) ) {
[7980] Fix | Delete
$imageChoices.prop( 'checked', false ).trigger( 'change' );
[7981] Fix | Delete
}
[7982] Fix | Delete
[7983] Fix | Delete
// Toggle Advanced > Dynamic Choices on or off.
[7984] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-row-${ fieldID }-dynamic_choices` ).toggleClass( 'wpforms-hidden', checked );
[7985] Fix | Delete
[7986] Fix | Delete
// Toggle subfields.
[7987] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-row-${ fieldID }-choices_icons_color` ).toggleClass( 'wpforms-hidden' );
[7988] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-row-${ fieldID }-choices_icons_size` ).toggleClass( 'wpforms-hidden' );
[7989] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-row-${ fieldID }-choices_icons_style` ).toggleClass( 'wpforms-hidden' );
[7990] Fix | Delete
[7991] Fix | Delete
const $colorOption = $fieldOptions.find( `#wpforms-field-option-${ fieldID }-choices_icons_color` ),
[7992] Fix | Delete
colorValue = _.isEmpty( $colorOption.val() ) ? wpforms_builder.icon_choices.default_color : $colorOption.val();
[7993] Fix | Delete
[7994] Fix | Delete
// Set accent color for all choices.
[7995] Fix | Delete
$choicesList.prop( 'style', `${ app.iconChoices.config.colorPropertyName }: ${ colorValue };` );
[7996] Fix | Delete
[7997] Fix | Delete
// Toggle icon selectors with previews for all choices.
[7998] Fix | Delete
$choicesList.toggleClass( 'show-icons', checked );
[7999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function