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

84 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * Show the radio field on the front-end.
8 * Extra line breaks show as space on the front-end when
9 * the form is double filtered and not minimized.
10 *
11 * @phpcs:disable Generic.WhiteSpace.ScopeIndent
12 */
13
14 if ( isset( $field['post_field'] ) && $field['post_field'] === 'post_category' ) {
15 $type = $field['type'];
16 do_action( 'frm_after_checkbox', compact( 'field', 'field_name', 'type' ) );
17 } elseif ( is_array( $field['options'] ) ) {
18 foreach ( $field['options'] as $opt_key => $opt ) {
19 if ( isset( $shortcode_atts ) && isset( $shortcode_atts['opt'] ) && ( $shortcode_atts['opt'] !== $opt_key ) ) {
20 continue;
21 }
22
23 $field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field );
24 $opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
25
26 /**
27 * Allows changing the HTML of option label in choice field (radio, checkbox,...).
28 *
29 * @since 5.0.04
30 *
31 * @param string $label Label HTML.
32 * @param array $args The arguments. Contains `field`.
33 */
34 $label = apply_filters( 'frm_choice_field_option_label', $opt, compact( 'field' ) );
35 ?>
36 <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
37
38 if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
39 $label_attributes = array(
40 'for' => $html_id . '-' . $opt_key,
41 );
42
43 if ( $read_only ) {
44 $label_attributes['class'] = 'frm-label-disabled';
45 }
46 ?>
47 <label <?php FrmAppHelper::array_to_html_params( $label_attributes, true ); ?>>
48 <?php
49 }
50
51 $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
52
53 $other_opt = false;
54 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
55 ?>
56 <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 ); ?>"
57 <?php
58 echo $checked . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
59 do_action( 'frm_field_input_html', $field );
60 ?>/><?php
61
62 if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
63 echo ' ' . FrmAppHelper::kses( $label, 'all' ) . '</label>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
64 }
65
66 $other_args = array(
67 'other_opt' => $other_opt,
68 'read_only' => $read_only,
69 'checked' => $checked,
70 'name' => $other_args['name'],
71 'value' => $other_args['value'],
72 'field' => $field,
73 'html_id' => $html_id,
74 'opt_key' => $opt_key,
75 'opt_label' => $opt,
76 );
77 FrmFieldsHelper::include_other_input( $other_args );
78
79 unset( $other_opt, $other_args );
80 ?></div>
81 <?php
82 }//end foreach
83 }//end if
84