PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.7
JetFormBuilder — Dynamic Blocks Form Builder v3.4.7
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-render.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-render.php
49 lines
1 <?php
2
3 namespace JFB_Modules\Option_Field\Blocks\Select;
4
5 use Jet_Form_Builder\Blocks\Render\Base;
6
7 // If this file is called directly, abort.
8 if ( ! defined( 'WPINC' ) ) {
9 die;
10 }
11
12 /**
13 * @property Block_Type $block_type
14 *
15 * Class Select_Field_Render
16 * @package Jet_Form_Builder\Blocks\Render
17 */
18 class Block_Render extends Base {
19
20 public function get_name() {
21 return 'select-field';
22 }
23
24 protected function set_checked_option( array &$option ) {
25 $this->block_type->is_multiple()
26 ? $this->modify_option_from_array( $option )
27 : $this->modify_option_from_single( $option );
28 }
29
30 protected function modify_option_from_array( array &$option ) {
31 $value = $this->args['default'];
32
33 if ( ! is_array( $value ) ) {
34 return;
35 }
36
37 if ( in_array( (string) $option['value'], $value, true ) ) {
38 $option['selected'] = true;
39 }
40 }
41
42 protected function modify_option_from_single( array &$option ) {
43 if ( (string) $option['value'] === (string) $this->args['default'] ) {
44 $option['selected'] = true;
45 }
46 }
47
48 }
49