PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.6
JetFormBuilder — Dynamic Blocks Form Builder v3.1.6
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 / includes / blocks / action-buttons-manager.php
jetformbuilder / includes / blocks Last commit date
advanced-rules 2 years ago button-types 2 years ago conditional-block 2 years ago exceptions 2 years ago modules 2 years ago render 2 years ago ssr-validation 2 years ago types 2 years ago validation-messages 2 years ago action-buttons-manager.php 2 years ago block-helper.php 2 years ago blocks-repository-base.php 2 years ago default-blocks-repository.php 2 years ago dynamic-value.php 2 years ago form-builder-blocks-repository.php 2 years ago module.php 2 years ago native-block-wrapper-attributes.php 2 years ago validation.php 2 years ago
action-buttons-manager.php
85 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Blocks;
5
6 use Jet_Form_Builder\Blocks\Button_Types\Button_Type_Base;
7
8 // If this file is called directly, abort.
9 if ( ! defined( 'WPINC' ) ) {
10 die;
11 }
12
13 /**
14 * CRUD
15 *
16 * Trait Action_Buttons_Manager
17 *
18 * @package Jet_Form_Builder\Blocks
19 */
20 trait Action_Buttons_Manager {
21
22 /**
23 * @var Button_Type_Base[]
24 */
25 private $button_types = array();
26
27 public function get_button_types() {
28 return $this->button_types;
29 }
30
31 public function get_button_types_for_js() {
32 $prepared = array();
33
34 /** @var Button_Type_Base $type */
35 foreach ( $this->get_button_types() as $type ) {
36 $prepared[] = array(
37 'value' => $type->slug(),
38 'label' => $type->label(),
39 'button_class' => $type->get_class( 'button' ),
40 'wrapper_class' => $type->get_class( 'wrapper' ),
41 );
42 }
43
44 return $prepared;
45 }
46
47 /**
48 * @param Button_Type_Base $button
49 * @param bool $update
50 */
51 public function set_button_type( Button_Type_Base $button, $update = false ) {
52 if ( ! $update && $this->isset_button_type( $button->slug() ) ) {
53 return;
54 }
55 $this->button_types[ $button->slug() ] = $button;
56 }
57
58 public function update_button_type( Button_Type_Base $button ) {
59 $this->set_button_type( $button, true );
60 }
61
62 public function isset_button_type( string $slug ) {
63 return isset( $this->button_types[ $slug ] );
64 }
65
66 /**
67 * @param $slug
68 *
69 * @return Button_Type_Base
70 */
71 public function get_button_type( $slug ) {
72 return $this->button_types[ $slug ];
73 }
74
75 public function delete_button_type( $slug ) {
76 if ( ! $this->isset_button_type( $slug ) ) {
77 return false;
78 }
79 unset( $this->button_types[ $slug ] );
80
81 return true;
82 }
83
84 }
85