PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / views / frm-fields / front-end / combo-field / combo-field.php

combo-field.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 5.2, at classes/views/frm-fields/front-end/combo-field/combo-field.php

89 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Frontend template for combo field
4 *
5 * @package Formidable
6 * @since 4.10.02
7 *
8 * @var array $args Data passed to this view. See FrmFieldCombo::load_field_output().
9 * @var array $shortcode_atts Shortcode attributes.
10 * @var array $sub_fields Sub fields array.
11 * @var string $html_id HTML ID.
12 * @var string $field_name Field Name.
13 * @var array $errors Field errors.
14 * @var bool $remove_names Remove field name or not.
15 * @var FrmFieldCombo $this Field type object.
16 */
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 die( 'You are not allowed to call this page directly.' );
20 }
21
22 $field = $args['field'];
23 $field_id = $field['id'];
24 $field_label = $field['name'];
25 $field_value = $field['value'];
26 $sub_fields = $args['sub_fields'];
27 $html_id = $args['html_id'];
28 $field_name = $args['field_name'];
29 $errors = $args['errors'];
30 $inputs_attrs = $this->get_inputs_container_attrs();
31 ?>
32 <fieldset aria-labelledby="<?php echo esc_attr( $html_id ); ?>_label">
33 <legend class="frm_screen_reader frm_hidden">
34 <?php echo esc_html( $field_label ); ?>
35 </legend>
36
37 <div <?php FrmAppHelper::array_to_html_params( $inputs_attrs, true ); ?>>
38 <?php
39 foreach ( $sub_fields as $name => $sub_field ) {
40 $sub_field['name'] = $name;
41 $sub_field_class = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}";
42 $sub_field_desc = FrmField::get_option( $field, $name . '_desc' );
43
44 if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) {
45 $sub_field_class .= ' frm_blank_field';
46 }
47 ?>
48 <div
49 id="frm_field_<?php echo esc_attr( $field_id . '-' . $name ); ?>_container"
50 class="<?php echo esc_attr( $sub_field_class ); ?>"
51 data-sub-field-name="<?php echo esc_attr( $name ); ?>"
52 >
53 <label for="<?php echo esc_attr( $html_id . '_' . $name ); ?>" class="frm_screen_reader frm_hidden">
54 <?php echo esc_html( $sub_field_desc ? $sub_field_desc : $field_label ); ?>
55 </label>
56
57 <?php
58 switch ( $sub_field['type'] ) {
59 default:
60 ?>
61 <input
62 type="<?php echo esc_attr( $sub_field['type'] ); ?>"
63 id="<?php echo esc_attr( $html_id . '_' . $name ); ?>"
64 value="<?php echo esc_attr( isset( $field_value[ $name ] ) ? $field_value[ $name ] : '' ); ?>"
65 <?php
66 if ( empty( $args['remove_names'] ) ) {
67 echo 'name="' . esc_attr( $field_name ) . '[' . esc_attr( $name ) . ']" ';
68 }
69
70 $this->print_input_atts( compact( 'field', 'sub_field' ) );
71 ?>
72 />
73 <?php
74 }
75
76 if ( $sub_field['label'] && ( $sub_field_desc || $this->should_print_hidden_sub_fields() ) ) {
77 echo '<div class="frm_description" id="frm_field_' . esc_attr( $field_id . '_' . $sub_field['name'] ) . '_desc">' . FrmAppHelper::kses( $sub_field_desc ) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
78 }
79
80 // Don't show individual field errors when there is a combo field error.
81 if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) {
82 ?>
83 <div class="frm_error" role="alert"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div>
84 <?php } ?>
85 </div>
86 <?php } ?>
87 </div>
88 </fieldset>
89