: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
wpforms_validate_field_id( $field['id'] ),
esc_html__( 'General', 'wpforms-lite' ),
$output = '</div></div>';
$value = ! empty( $field['label'] ) ? esc_html( $field['label'] ) : '';
$tooltip = ! empty( $args['tooltip'] ) ? $args['tooltip'] : esc_html__( 'Enter text for the form field label. Field labels are recommended and can be hidden in the Advanced Settings.', 'wpforms-lite' );
$output = $this->field_element(
'value' => esc_html__( 'Label', 'wpforms-lite' ),
$output .= $this->field_element(
$output = $this->field_element(
$value = ! empty( $field['description'] ) ? esc_html( $field['description'] ) : '';
$tooltip = esc_html__( 'Enter text for the form field description.', 'wpforms-lite' );
$output = $this->field_element(
'value' => esc_html__( 'Description', 'wpforms-lite' ),
$output .= $this->field_element(
$output = $this->field_element(
$default = ! empty( $args['default'] ) ? $args['default'] : '0';
$value = isset( $field['required'] ) ? esc_attr( $field['required'] ) : esc_attr( $default );
$tooltip = esc_html__( 'Check this option to mark the field required. A form will not submit unless all required fields are provided.', 'wpforms-lite' );
$output = $this->field_element(
'desc' => esc_html__( 'Required', 'wpforms-lite' ),
$output = $this->field_element(
* Field Meta (field type and ID).
_deprecated_argument( __CLASS__ . '::' . __METHOD__ . '( [ \'slug\' => \'meta\' ] )', '1.7.1 of the WPForms plugin' );
$output = sprintf( '<label>%s</label>', esc_html__( 'Type', 'wpforms-lite' ) );
'<p class="meta">%s <span class="id">(ID #%s)</span></p>',
wpforms_validate_field_id( $field['id'] )
$output = $this->field_element(
$value = ! empty( $field['code'] ) ? esc_textarea( $field['code'] ) : '';
$tooltip = esc_html__( 'Enter code for the form field.', 'wpforms-lite' );
$output = $this->field_element(
'value' => esc_html__( 'Code', 'wpforms-lite' ),
$output .= $this->field_element(
$output = $this->field_element(
$values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults;
$label = ! empty( $args['label'] ) ? esc_html( $args['label'] ) : esc_html__( 'Choices', 'wpforms-lite' );
$field_type = $this->type;
if ( ! empty( $field['multiple'] ) ) {
$field_type = 'checkbox';
if ( ! empty( $field['show_values'] ) ) {
$class[] = 'show-values';
if ( ! empty( $field['dynamic_choices'] ) ) {
$class[] = 'wpforms-hidden';
if ( ! empty( $field['choices_images'] ) ) {
$class[] = 'show-images';
if ( ! empty( $field['choices_icons'] ) ) {
$icon_color = isset( $field['choices_icons_color'] ) ? wpforms_sanitize_hex_color( $field['choices_icons_color'] ) : '';
$icon_color = empty( $icon_color ) ? IconChoices::get_default_color() : $icon_color;
$inline_style = "--wpforms-icon-choices-color: {$icon_color};";
$lbl = $this->field_element(
'tooltip' => esc_html__( 'Add choices for the form field.', 'wpforms-lite' ),
'after_tooltip' => '<a href="#" class="toggle-bulk-add-display toggle-unfoldable-cont"><i class="fa fa-download"></i><span>' . esc_html__( 'Bulk Add', 'wpforms-lite' ) . '</span></a>',
'<ul data-next-id="%s" class="choices-list %s" data-field-id="%s" data-field-type="%s" style="%s">',
max( array_keys( $values ) ) + 1,
wpforms_sanitize_classes( $class, true ),
wpforms_validate_field_id( $field['id'] ),
esc_attr( $inline_style )
foreach ( $values as $key => $value ) {
$default = ! empty( $value['default'] ) ? $value['default'] : '';
$base = sprintf( 'fields[%s][choices][%d]', wpforms_validate_field_id( $field['id'] ), absint( $key ) );
$label = isset( $value['label'] ) ? $value['label'] : '';
$image = ! empty( $value['image'] ) ? $value['image'] : '';
$icon = isset( $value['icon'] ) && ! wpforms_is_empty_string( $value['icon'] ) ? $value['icon'] : IconChoices::DEFAULT_ICON;
$icon_style = ! empty( $value['icon_style'] ) ? $value['icon_style'] : IconChoices::DEFAULT_ICON_STYLE;
$fld .= '<li data-key="' . absint( $key ) . '">';
'<input type="%s" name="%s[default]" class="default" value="1" %s>',
$field_type === 'checkbox' ? 'checkbox' : 'radio',
checked( '1', $default, false )
$fld .= '<span class="move"><i class="fa fa-bars"></i></span>';
'<input type="text" name="%s[label]" value="%s" class="label">',
$fld .= '<a class="add" href="#"><i class="fa fa-plus-circle"></i></a><a class="remove" href="#"><i class="fa fa-minus-circle"></i></a>';
'<input type="text" name="%s[value]" value="%s" class="value">',
esc_attr( ! isset( $value['value'] ) ? '' : $value['value'] )
$fld .= '<div class="wpforms-image-upload">';
$fld .= '<div class="preview">';
if ( ! empty( $image ) ) {
'<img src="%s"><a href="#" title="%s" class="wpforms-image-upload-remove"><i class="fa fa-trash-o"></i></a>',
esc_attr__( 'Remove Image', 'wpforms-lite' )
'<button class="wpforms-btn wpforms-btn-sm wpforms-btn-blue wpforms-btn-block wpforms-image-upload-add" data-after-upload="hide"%s>%s</button>',
$hide_image_btn ? ' style="display:none;"' : '',
esc_html__( 'Upload Image', 'wpforms-lite' )
'<input type="hidden" name="%s[image]" value="%s" class="source">',
'<div class="wpforms-icon-select">
<i class="ic-fa-preview ic-fa-%1$s ic-fa-%2$s"></i>
<i class="fa fa-edit"></i>
<input type="hidden" name="%3$s[icon]" value="%2$s" class="source-icon">
<input type="hidden" name="%3$s[icon_style]" value="%1$s" class="source-icon-style">
// Field note: dynamic status.
$dynamic = ! empty( $field['dynamic_choices'] ) ? esc_html( $field['dynamic_choices'] ) : '';
if ( $dynamic === 'post_type' && ! empty( $field[ 'dynamic_' . $dynamic ] ) ) {
$type = esc_html__( 'post type', 'wpforms-lite' );
$pt = get_post_type_object( $field[ 'dynamic_' . $dynamic ] );
$source = $pt->labels->name;
} elseif ( $dynamic === 'taxonomy' && ! empty( $field[ 'dynamic_' . $dynamic ] ) ) {
$type = esc_html__( 'taxonomy', 'wpforms-lite' );
$tax = get_taxonomy( $field[ 'dynamic_' . $dynamic ] );
$source = $tax->labels->name;
'<div class="wpforms-alert-warning wpforms-alert %s">',
! empty( $dynamic ) && ! empty( $field[ 'dynamic_' . $dynamic ] ) ? '' : 'wpforms-hidden'
$note .= '<h4>' . esc_html__( 'Dynamic Choices Active', 'wpforms-lite' ) . '</h4>';
/* translators: %1$s - source name, %2$s - type name. */
'<p>' . esc_html__( 'Choices are dynamically populated from the %1$s %2$s. Go to the Advanced tab to change this.', 'wpforms-lite' ) . '</p>',
'<span class="dynamic-name">' . esc_html( $source ) . '</span>',
'<span class="dynamic-type">' . esc_html( $type ) . '</span>'
$output = $this->field_element(
'content' => $lbl . $fld . $note,
$values = ! empty( $field['choices'] ) ? $field['choices'] : $this->defaults;
$input_type = in_array( $field['type'], [ 'payment-multiple', 'payment-select' ], true ) ? 'radio' : 'checkbox';
if ( ! empty( $field['choices_images'] ) ) {
$class[] = 'show-images';
if ( ! empty( $field['choices_icons'] ) ) {
$icon_color = isset( $field['choices_icons_color'] ) ? wpforms_sanitize_hex_color( $field['choices_icons_color'] ) : '';
$icon_color = empty( $icon_color ) ? IconChoices::get_default_color() : $icon_color;
$inline_style = "--wpforms-icon-choices-color: {$icon_color};";
$lbl = $this->field_element(
'value' => esc_html__( 'Items', 'wpforms-lite' ),
'tooltip' => esc_html__( 'Add choices for the form field.', 'wpforms-lite' ),
'<ul data-next-id="%s" class="choices-list %s" data-field-id="%s" data-field-type="%s" style="%s">',
max( array_keys( $values ) ) + 1,
wpforms_sanitize_classes( $class, true ),
wpforms_validate_field_id( $field['id'] ),
esc_attr( $inline_style )
foreach ( $values as $key => $value ) {
$default = ! empty( $value['default'] ) ? $value['default'] : '';
$base = sprintf( 'fields[%s][choices][%d]', wpforms_validate_field_id( $field['id'] ), absint( $key ) );
$image = ! empty( $value['image'] ) ? $value['image'] : '';
$icon = isset( $value['icon'] ) && ! wpforms_is_empty_string( $value['icon'] ) ? $value['icon'] : IconChoices::DEFAULT_ICON;
$icon_style = ! empty( $value['icon_style'] ) ? $value['icon_style'] : IconChoices::DEFAULT_ICON_STYLE;
$fld .= '<li data-key="' . absint( $key ) . '">';
'<input type="%s" name="%s[default]" class="default" value="1" %s>',
checked( '1', $default, false )
$fld .= '<span class="move"><i class="fa fa-bars"></i></span>';
'<input type="text" name="%s[label]" value="%s" class="label">',
esc_attr( $value['label'] )
'<input type="text" name="%s[value]" value="%s" class="value wpforms-money-input" placeholder="%s">',
esc_attr( wpforms_format_amount( wpforms_sanitize_amount( $value['value'] ) ) ),
wpforms_format_amount( 0 )
$fld .= '<a class="add" href="#"><i class="fa fa-plus-circle"></i></a><a class="remove" href="#"><i class="fa fa-minus-circle"></i></a>';
$fld .= '<div class="wpforms-image-upload">';
$fld .= '<div class="preview">';
if ( ! empty( $image ) ) {
'<img src="%s"><a href="#" title="%s" class="wpforms-image-upload-remove"><i class="fa fa-trash-o"></i></a>',
esc_attr__( 'Remove Image', 'wpforms-lite' )
'<button class="wpforms-btn wpforms-btn-sm wpforms-btn-blue wpforms-btn-block wpforms-image-upload-add" data-after-upload="hide"%s>%s</button>',
$hide_image_btn ? ' style="display:none;"' : '',
esc_html__( 'Upload Image', 'wpforms-lite' )
'<input type="hidden" name="%s[image]" value="%s" class="source">',
'<div class="wpforms-icon-select">
<i class="ic-fa-preview ic-fa-%1$s ic-fa-%2$s""></i>
<i class="fa fa-edit"></i>
<input type="hidden" name="%3$s[icon]" value="%2$s" class="source-icon">
<input type="hidden" name="%3$s[icon_style]" value="%1$s" class="source-icon-style">
$output = $this->field_element(
'content' => $lbl . $fld,
// Field note: Image tips.
'<div class="wpforms-alert-warning wpforms-alert %s">',
! empty( $field['choices_images'] ) ? '' : 'wpforms-hidden'
__( '<h4>Images are not cropped or resized.</h4><p>For best results, they should be the same size and 250x250 pixels or smaller.</p>', 'wpforms-lite' ),