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 / back-end / radio-field.php

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

61 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Radio field front-end input.
4 *
5 * @package Formidable
6 *
7 * @var array $field Field data including 'post_field', 'type', 'options', 'value'.
8 * @var string $field_name HTML name attribute for the radio inputs.
9 * @var string $html_id HTML id prefix for each radio option.
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 die( 'You are not allowed to call this page directly.' );
14 }
15
16 if ( isset( $field['post_field'] ) && $field['post_field'] === 'post_category' ) {
17 $type = $field['type'];
18 do_action( 'frm_after_checkbox', compact( 'field', 'field_name', 'type' ) );
19 } elseif ( is_array( $field['options'] ) ) {
20 foreach ( $field['options'] as $opt_key => $opt ) {
21 $field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field );
22 $opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
23 ?>
24 <div class="frm_radio">
25 <label for="<?php echo esc_attr( $html_id . '-' . $opt_key ); ?>">
26 <?php
27 $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
28 $other_opt = false;
29 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
30 ?>
31 <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 ); ?>" <?php
32 echo $checked; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
33 do_action( 'frm_field_input_html', $field );
34 ?>/>
35 <?php
36 echo ' ';
37 FrmAppHelper::kses_echo( $opt, 'all' );
38 ?>
39 </label>
40 <?php
41 FrmFieldsHelper::include_other_input(
42 array(
43 'other_opt' => $other_opt,
44 'read_only' => false,
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 );
54
55 unset( $other_opt, $other_args );
56 ?>
57 </div>
58 <?php
59 }//end foreach
60 }//end if
61