PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 trunk, at classes/views/frm-fields/front-end/combo-field/combo-field.php

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