PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.5.6.3
JetFormBuilder — Dynamic Blocks Form Builder v3.5.6.3
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / option-field / blocks / select / block-template.php
jetformbuilder / modules / option-field / blocks / select Last commit date
block-render.php 2 years ago block-template.php 2 years ago block-type.php 2 years ago
block-template.php
84 lines
1 <?php
2 /**
3 * input[type="hidden"] template
4 *
5 * @var Block_Render $this
6 * @var array $args
7 */
8
9 use JFB_Modules\Option_Field\Blocks\Select\Block_Render;
10
11 // If this file is called directly, abort.
12 if ( ! defined( 'WPINC' ) ) {
13 die;
14 }
15
16 $this->add_attribute( 'class', 'jet-form-builder__field select-field' );
17 $this->add_attribute( 'class', $args['class_name'] );
18 $this->add_attribute( 'required', $this->block_type->get_required_val() );
19 $this->add_attribute( 'name', $this->block_type->get_field_name() );
20 $this->add_attribute( 'data-field-name', $args['name'] );
21 $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) );
22 $this->add_attribute( 'multiple', $this->block_type->is_multiple() ? 1 : '' );
23 $this->add_attribute(
24 'size',
25 $this->block_type->is_multiple()
26 ? $this->block_type->get_multiple_size()
27 : ''
28 );
29 $this->add_attribute( 'data-jfb-sync' );
30
31 $placeholder = $args['placeholder'] ?? false;
32 $default = $args['default'] ?? false;
33
34 $this->add_attribute( 'data-default-val', $default );
35 ?>
36 <div class="jet-form-builder__field-wrap">
37 <select <?php $this->render_attributes_string(); ?>>
38 <?php
39
40 if ( $placeholder ) {
41 $additional_attrs = ( $args['is_disabled_placeholder'] ?? false ) ? 'disabled' : '';
42
43 if ( ! $default ) {
44 $additional_attrs .= ' selected';
45 }
46 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
47 printf( '<option value="" %1$s>%2$s</option>', $additional_attrs, $placeholder );
48 }
49
50 if ( ! empty( $args['field_options'] ) ) {
51
52 foreach ( $args['field_options'] as $value => $option ) {
53
54 $selected = '';
55 $calc = '';
56
57 if ( is_array( $option ) ) {
58 $val = $option['value'];
59 $label = $option['label'];
60 } else {
61 $val = $value;
62 $label = $option;
63 }
64
65 $this->set_checked_option( $option );
66
67 if ( ! empty( $option['selected'] ) ) {
68 $selected = 'selected="selected"';
69 }
70
71 if ( is_array( $option ) && isset( $option['calculate'] ) ) {
72 $calc = ' data-calculate="' . esc_attr( $option['calculate'] ) . '"';
73 }
74
75 printf( '<option value="%1$s" %3$s%4$s>%2$s</option>', $val, $label, $selected, $calc );
76
77 }
78 }
79
80 ?>
81 </select>
82 </div>
83 <?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
84