PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.4.5.2
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 / compatibility / jet-style-manager / jet-style-manager.php
jetformbuilder / compatibility / jet-style-manager Last commit date
blocks 2 years ago jet-style-manager.php 2 years ago
jet-style-manager.php
114 lines
1 <?php
2
3
4 namespace JFB_Compatibility\Jet_Style_Manager;
5
6 use JET_SM\Gutenberg\Controls_Manager;
7 use JFB_Compatibility\Jet_Style_Manager\Blocks\Form;
8 use JFB_Compatibility\Jet_Style_Manager\Blocks\Interfaces\Style_Block_It;
9 use JFB_Components\Module\Base_Module_After_Install_It;
10 use JFB_Components\Module\Base_Module_It;
11 use JFB_Components\Repository\Interfaces\Repository_Pattern_Interface;
12 use JFB_Components\Repository\Repository_Pattern_Trait;
13
14 // If this file is called directly, abort.
15 if ( ! defined( 'WPINC' ) ) {
16 die;
17 }
18
19 class Jet_Style_Manager implements Base_Module_It, Base_Module_After_Install_It, Repository_Pattern_Interface {
20
21 use Repository_Pattern_Trait;
22
23 public function rep_item_id() {
24 return 'jet-style-manager';
25 }
26
27 public function on_install() {
28 $this->rep_install();
29 }
30
31 public function on_uninstall() {
32 $this->rep_clear();
33 }
34
35 public function condition(): bool {
36 return (
37 class_exists( 'JET_SM\Gutenberg\Controls_Manager' )
38 && class_exists( 'JET_SM\Gutenberg\Block_Manager' )
39 );
40 }
41
42 public function init_hooks() {
43 add_action( 'init', array( $this, 'register_block_styles' ), 9 );
44 }
45
46 public function remove_hooks() {
47 add_action( 'init', array( $this, 'register_block_styles' ), 9 );
48 }
49
50
51 public function rep_instances(): array {
52 return array(
53 new Form(),
54 );
55 }
56
57 public function register_block_styles() {
58 /** @var Style_Block_It $block */
59 foreach ( $this->rep_generate_items() as $block ) {
60 $block->set_namespace( '.jet-form-builder' );
61 $block->set_manager( new Controls_Manager( $block->rep_item_id() ) );
62 $block->process_controls();
63 }
64 }
65
66 public function create_margin( string $selector, $extra_options = array() ): array {
67 $margin = array(
68 'type' => 'dimensions',
69 'label' => __( 'Margin', 'jet-form-builder' ),
70 'units' => array( 'px', '%' ),
71 'separator' => 'after',
72 'css_selector' => array(
73 $selector => 'margin: {{TOP}} {{RIGHT}} {{BOTTOM}} {{LEFT}};',
74 ),
75 );
76
77 // probably an id of the control
78 if ( is_string( $extra_options ) ) {
79 $margin['id'] = $extra_options;
80 }
81 if ( is_array( $extra_options ) && $extra_options ) {
82 $margin = array_merge( $margin, $extra_options );
83 }
84
85 return $margin;
86 }
87
88 public function create_padding( string $selector, $extra_options = array() ): array {
89 $padding = array(
90 'type' => 'dimensions',
91 'label' => __( 'Padding', 'jet-form-builder' ),
92 'units' => array( 'px', '%', 'em' ),
93 'separator' => 'after',
94 'css_selector' => array(
95 $selector => 'padding: {{TOP}} {{RIGHT}} {{BOTTOM}} {{LEFT}};',
96 ),
97 );
98
99 // probably an id of the control
100 if ( is_string( $extra_options ) ) {
101 $padding['id'] = $extra_options;
102 }
103 if ( is_array( $extra_options ) && $extra_options ) {
104 $padding = array_merge( $padding, $extra_options );
105 }
106
107 return $padding;
108 }
109
110 public function install( Style_Block_It $block ) {
111 $this->rep_install_item_soft( $block );
112 }
113 }
114