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

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

70 lines 2.2 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 if ( empty( $field['options'] ) ) {
30 $field['options'] = array();
31 }
32 foreach ( $field['options'] as $opt_key => $opt ) {
33 $field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field );
34 $opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
35 $selected = FrmAppHelper::check_selected( $field['value'], $field_val );
36 if ( $other_opt === false ) {
37 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $selected );
38 if ( FrmFieldsHelper::is_other_opt( $opt_key ) && $selected ) {
39 $other_checked = true;
40 }
41 }
42
43 if ( $placeholder && $opt == '' && ! $skipped ) {
44 $skipped = true;
45 continue;
46 }
47 ?>
48 <option value="<?php echo esc_attr( $field_val ); ?>" <?php echo $selected ? ' selected="selected"' : ''; ?> class="<?php echo esc_attr( FrmFieldsHelper::is_other_opt( $opt_key ) ? 'frm_other_trigger' : '' ); ?>">
49 <?php echo esc_html( $opt == '' ? ' ' : $opt ); ?>
50 </option>
51 <?php } ?>
52 </select>
53 <?php
54
55 if ( isset( $other_args ) ) {
56 FrmFieldsHelper::include_other_input(
57 array(
58 'other_opt' => $other_opt,
59 'read_only' => $read_only,
60 'checked' => $other_checked,
61 'name' => $other_args['name'],
62 'value' => $other_args['value'],
63 'field' => $field,
64 'html_id' => $html_id,
65 'opt_key' => false,
66 )
67 );
68 }
69 }
70