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 / compatibility / jet-engine / option-query / inner-module.php

inner-module.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.6, at compatibility/jet-engine/option-query/inner-module.php

69 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 JFB_Compatibility\Jet_Engine\Option_Query;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 use JFB_Modules\Option_Field\Interfaces\Support_Option_Query_It;
12 use Jet_Form_Builder\Blocks\Types\Base;
13 use JFB_Modules\Option_Query\Module;
14
15 class Inner_Module implements \JFB_Components\Module\Base_Module_It {
16
17 public function rep_item_id() {
18 return 'je-option-query';
19 }
20
21 public function condition(): bool {
22 return true;
23 }
24
25 public function init_hooks() {
26 add_action(
27 'jet-form-builder/option-query/on-install',
28 array( $this, 'add_option_queries' )
29 );
30 // connect to the blocks
31 add_action(
32 'jet-form-builder/option-query/set-in-block',
33 array( $this, 'on_set_in_block' )
34 );
35 }
36
37 public function remove_hooks() {
38 remove_action(
39 'jet-form-builder/option-query/on-install',
40 array( $this, 'add_option_queries' )
41 );
42 remove_action(
43 'jet-form-builder/option-query/set-in-block',
44 array( $this, 'on_set_in_block' )
45 );
46 }
47
48 public function add_option_queries( Module $module ) {
49 if ( jet_engine()->glossaries ) {
50 $module->install( new Glossary_Query() );
51 }
52 }
53
54 /**
55 * @param Base|Support_Option_Query_It $block
56 */
57 public function on_set_in_block( Base $block ) {
58 switch ( $block->get_query()->rep_item_id() ) {
59 case 'glossary':
60 $block->get_query()->set_query(
61 'id',
62 $block->block_attrs['glossary_id'] ?? 0
63 );
64 break;
65 }
66 }
67
68 }
69