PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.05.02
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.05.02
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 / radio-field.php

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

60 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Show the radio field on the front-end.
4 * Extra line breaks show as space on the front-end when
5 * the form is double filtered and not minimized.
6 *
7 * @phpcs:disable Generic.WhiteSpace.ScopeIndent
8 */
9
10 if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
11 $type = $field['type'];
12 do_action( 'frm_after_checkbox', compact( 'field', 'field_name', 'type' ) );
13 } elseif ( is_array( $field['options'] ) ) {
14 foreach ( $field['options'] as $opt_key => $opt ) {
15 if ( isset( $shortcode_atts ) && isset( $shortcode_atts['opt'] ) && ( $shortcode_atts['opt'] !== $opt_key ) ) {
16 continue;
17 }
18
19 $field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field );
20 $opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
21 ?>
22 <div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ); ?>" id="<?php echo esc_attr( FrmFieldsHelper::get_checkbox_id( $field, $opt_key, 'radio' ) ); ?>"><?php
23
24 if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
25 ?><label for="<?php echo esc_attr( $html_id ); ?>-<?php echo esc_attr( $opt_key ); ?>"><?php
26 }
27 $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
28
29 $other_opt = false;
30 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
31 ?>
32 <input type="radio" name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ); ?>" value="<?php echo esc_attr( $field_val ); ?>"
33 <?php
34 echo $checked . ' '; // WPCS: XSS ok.
35 do_action( 'frm_field_input_html', $field );
36 ?>/><?php
37
38 if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
39 echo ' ' . FrmAppHelper::kses( $opt, 'all' ) . '</label>'; // WPCS: XSS ok.
40 }
41
42 $other_args = array(
43 'other_opt' => $other_opt,
44 'read_only' => $read_only,
45 'checked' => $checked,
46 'name' => $other_args['name'],
47 'value' => $other_args['value'],
48 'field' => $field,
49 'html_id' => $html_id,
50 'opt_key' => $opt_key,
51 'opt_label' => $opt,
52 );
53 FrmFieldsHelper::include_other_input( $other_args );
54
55 unset( $other_opt, $other_args );
56 ?></div>
57 <?php
58 }
59 }
60