PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.6
JetFormBuilder — Dynamic Blocks Form Builder v3.6.6
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 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 All 134 releases
jetformbuilder / includes / blocks / conditional-block / render-states / base-render-state.php

base-render-state.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.6, at includes/blocks/conditional-block/render-states/base-render-state.php

66 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Jet_Form_Builder\Blocks\Conditional_Block\Render_States;
5
6 use Jet_Form_Builder\Blocks\Conditional_Block\Render_State;
7 use Jet_Form_Builder\Classes\Arrayable\Arrayable;
8 use Jet_Form_Builder\Classes\Arrayable\Collection_Item_Interface;
9 use JFB_Components\Repository\Repository_Item_Instance_Trait;
10
11 // If this file is called directly, abort.
12 if ( ! defined( 'WPINC' ) ) {
13 die;
14 }
15
16 abstract class Base_Render_State implements
17 Repository_Item_Instance_Trait,
18 Collection_Item_Interface,
19 Arrayable {
20
21 abstract public function get_title(): string;
22
23 abstract public function is_supported(): bool;
24
25 public function is_supported_on_current(): bool {
26 return $this->is_supported();
27 }
28
29 public function rep_item_id() {
30 return $this->get_id();
31 }
32
33 public function render(): string {
34 return sprintf(
35 '<input type="hidden" name="%1$s[]" value="%2$s" data-jfb-sync />',
36 Render_State::FIELD_NAME,
37 $this->get_id()
38 );
39 }
40
41 /**
42 * Determines the availability of this state for switching
43 * to it using the Action Button
44 *
45 * @return bool
46 */
47 public function can_be_switched(): bool {
48 return false;
49 }
50
51 public function exclude_states(): array {
52 return array(
53 Default_State::class,
54 );
55 }
56
57 public function to_array(): array {
58 return array(
59 'value' => $this->get_id(),
60 'label' => $this->get_title(),
61 'can_be_switched' => $this->can_be_switched(),
62 );
63 }
64
65 }
66