PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.3.1
JetFormBuilder — Dynamic Blocks Form Builder v3.3.1
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
button-types 2 years ago conditional-block 2 years ago exceptions 2 years ago modules 2 years ago render 2 years ago types 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
action-buttons-manager.php
83 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 foreach ( $this->get_button_types() as $type ) {
35 $prepared[] = array(
36 'value' => $type->slug(),
37 'button_class' => $type->get_class( 'button' ),
38 'wrapper_class' => $type->get_class( 'wrapper' ),
39 );
40 }
41
42 return $prepared;
43 }
44
45 /**
46 * @param Button_Type_Base $button
47 * @param bool $update
48 */
49 public function set_button_type( Button_Type_Base $button, $update = false ) {
50 if ( ! $update && $this->isset_button_type( $button->slug() ) ) {
51 return;
52 }
53 $this->button_types[ $button->slug() ] = $button;
54 }
55
56 public function update_button_type( Button_Type_Base $button ) {
57 $this->set_button_type( $button, true );
58 }
59
60 public function isset_button_type( string $slug ) {
61 return isset( $this->button_types[ $slug ] );
62 }
63
64 /**
65 * @param $slug
66 *
67 * @return Button_Type_Base
68 */
69 public function get_button_type( $slug ) {
70 return $this->button_types[ $slug ];
71 }
72
73 public function delete_button_type( $slug ) {
74 if ( ! $this->isset_button_type( $slug ) ) {
75 return false;
76 }
77 unset( $this->button_types[ $slug ] );
78
79 return true;
80 }
81
82 }
83