p_kses(
sprintf(
/* translators: %d is the total number of choices available. */
__('Showing the first 20 choices.
All %d choices will be displayed when viewing the form.', 'mailchimp-for-wp'),
absint($total)
),
[ 'br' => [] ]
);
echo '';
}
// Description
$this->field_preview_option('description', $field);
}
/**
* Field display on the form front-end.
*
* @since 1.0.0
* @param null $field (deprecated)
* @param array $form_data
*/
public function field_display($field, $field_atts, $form_data)
{
// Setup some defaults because WPForms broke their integration in v1.8.1.1
$field_atts = array_merge([
'input_class' => [],
'input_id' => [],
], is_array($field_atts) ? $field_atts : []);
// Setup and sanitize the necessary data
$field_required = ! empty($field['required']);
$field_class = implode(' ', array_map('sanitize_html_class', (array) $field_atts['input_class']));
$field_id = implode(' ', array_map('sanitize_html_class', (array) $field_atts['input_id']));
$form_id = absint($form_data['id']);
$field_id_int = absint($field['id']);
$choices = (array) $field['choices'];
// List
printf('
', esc_attr($field_id), esc_attr($field_class));
foreach ($choices as $key => $choice) {
$selected = isset($choice['default']) ? '1' : '0';
$depth = isset($choice['depth']) ? absint($choice['depth']) : 1;
$key = absint($key);
$list_item_class = sprintf('choice-%d depth-%d', $key, $depth);
echo '- ';
$input_id = sprintf('wpforms-%d-field_%d_%d', $form_id, $field_id_int, $key);
// Checkbox elements
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- checked() and required flag return safe attribute fragments.
printf(
'',
esc_attr($input_id),
esc_attr(sprintf('wpforms[fields][%d]', $field_id_int)),
esc_attr($choice['value']),
checked('1', $selected, false),
$field_required ? 'required' : ''
);
printf('', esc_attr($input_id), esc_html($choice['label']));
echo '
';
}
echo '
';
}
/**
* Formats and sanitizes field.
*
* @since 1.0.2
* @param int $field_id
* @param array $field_submit
* @param array $form_data
*/
public function format($field_id, $field_submit, $form_data)
{
$field = $form_data['fields'][$field_id];
$choice = array_pop($field['choices']);
$name = sanitize_text_field($choice['label']);
$data = [
'name' => $name,
'value' => empty($field_submit) ? __('No', 'mailchimp-for-wp') : __('Yes', 'mailchimp-for-wp'),
'value_raw' => $field_submit,
'id' => absint($field_id),
'type' => $this->type,
];
wpforms()->process->fields[$field_id] = $data;
}
}
is?'=>'Are you sure you want to do this?','nounComment'=>'Comment','URL'=>'URL','Author'=>'Author','Log Out'=>'Log Out','Visit Site'=>'Visit Site','Y/m/d'=>'Y/m/d','Draft'=>'Draft','Pending Review'=>'Pending Review','Published'=>'Published','Title'=>'Title','No posts found.'=>'No posts found.','Password:'=>'Password:','Username:'=>'Username:','An error occurred during the activation'=>'An error occurred during the activation','Your account is now active!'=>'Your account is now active!','Activate'=>'Activate','Activation Key:'=>'Activation Key:','Activation Key Required'=>'Activation Key Required']];