PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4.4
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 / dropdown-field.php

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

85 lines 2.3 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 if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
7 echo FrmProPost::get_category_dropdown( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
8 $field,
9 array(
10 'location' => 'front',
11 'name' => $field_name,
12 'id' => $html_id,
13 )
14 );
15 } else {
16 if ( $read_only ) {
17 ?>
18 <select <?php do_action( 'frm_field_input_html', $field ); ?>>
19 <?php } else { ?>
20 <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $html_id ); ?>" <?php do_action( 'frm_field_input_html', $field ); ?>>
21 <?php
22 }
23
24 $placeholder = FrmFieldsController::add_placeholder_to_select( $field );
25
26 $skipped = false;
27 $other_opt = false;
28 $other_checked = false;
29
30 if ( empty( $field['options'] ) ) {
31 $field['options'] = array();
32 }
33
34 foreach ( $field['options'] as $opt_key => $opt ) {
35 $field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field );
36 $opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
37 $selected = FrmAppHelper::check_selected( $field['value'], $field_val );
38 if ( $other_opt === false ) {
39 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $selected );
40 if ( FrmFieldsHelper::is_other_opt( $opt_key ) && $selected ) {
41 $other_checked = true;
42 }
43 }
44
45 if ( $placeholder && $opt == '' && ! $skipped ) {
46 $skipped = true;
47 continue;
48 }
49
50 $option_params = array(
51 'value' => $field_val,
52 );
53 if ( $selected ) {
54 $option_params['selected'] = 'selected';
55 }
56 if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
57 $option_params['class'] = 'frm_other_trigger';
58 }
59 ?>
60 <option <?php FrmAppHelper::array_to_html_params( $option_params, true ); ?>>
61 <?php echo esc_html( $opt == '' ? ' ' : $opt ); ?>
62 </option>
63 <?php
64 unset( $option_params );
65 }
66 ?>
67 </select>
68 <?php
69
70 if ( isset( $other_args ) ) {
71 FrmFieldsHelper::include_other_input(
72 array(
73 'other_opt' => $other_opt,
74 'read_only' => $read_only,
75 'checked' => $other_checked,
76 'name' => $other_args['name'],
77 'value' => $other_args['value'],
78 'field' => $field,
79 'html_id' => $html_id,
80 'opt_key' => false,
81 )
82 );
83 }
84 }
85