PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.1
JetFormBuilder — Dynamic Blocks Form Builder v3.4.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 / compatibility / jet-engine / blocks / check-mark / block-asset.php
jetformbuilder / compatibility / jet-engine / blocks / check-mark Last commit date
assets 1 year ago interfaces 1 year ago block-asset.php 1 year ago block-attributes.php 1 year ago block-render.php 1 year ago block-template.php 1 year ago block.json 1 year ago
block-asset.php
119 lines
1 <?php
2
3 namespace JFB_Compatibility\Jet_Engine\Blocks\Check_Mark;
4
5 use Jet_Form_Builder\Blocks\Module;
6 use Jet_Form_Builder\Exceptions\Repository_Exception;
7 use JFB_Compatibility\Jet_Engine\Jet_Engine;
8 use JFB_Modules\Blocks_V2\Interfaces\Block_Asset_Interface;
9
10 class Block_Asset implements Block_Asset_Interface {
11
12 public function init_hooks() {
13 add_action(
14 'enqueue_block_editor_assets',
15 array( $this, 'enqueue_editor_assets' )
16 );
17 add_action(
18 'wp_enqueue_scripts',
19 array( $this, 'register_frontend_assets' )
20 );
21 add_action(
22 'jet_plugins/frontend/register_scripts',
23 array( $this, 'register_frontend_assets' )
24 );
25 }
26
27 /**
28 * @return void
29 * @throws Repository_Exception
30 */
31 public function register_frontend_assets() {
32 $script_asset = require_once $this->get_dir( '/assets/build/frontend/radio.asset.php' );
33
34 if ( true === $script_asset ) {
35 return;
36 }
37
38 array_push(
39 $script_asset['dependencies'],
40 'jet-fb-radio-field'
41 );
42
43 wp_register_style(
44 $this->get_handle( 'check-mark' ),
45 $this->get_url( '/assets/build/frontend/main.css' ),
46 array(),
47 $script_asset['version']
48 );
49
50 wp_register_script(
51 $this->get_handle( 'check-mark-radio' ),
52 $this->get_url( '/assets/build/frontend/radio.js' ),
53 $script_asset['dependencies'],
54 $script_asset['version'],
55 true
56 );
57
58 $script_asset = require_once $this->get_dir( '/assets/build/frontend/checkbox.asset.php' );
59
60 array_push(
61 $script_asset['dependencies'],
62 'jet-fb-checkbox-field'
63 );
64
65 wp_register_script(
66 $this->get_handle( 'check-mark-checkbox' ),
67 $this->get_url( '/assets/build/frontend/checkbox.js' ),
68 $script_asset['dependencies'],
69 $script_asset['version'],
70 true
71 );
72 }
73
74 /**
75 * @return void
76 */
77 public function enqueue_editor_assets() {
78 $screen = get_current_screen();
79
80 if ( ! $screen || 'jet-engine' !== $screen->post_type ) {
81 return;
82 }
83
84 $script_asset = require_once $this->get_dir( '/assets/build/editor.asset.php' );
85
86 wp_enqueue_script(
87 $this->get_handle( 'check-mark-editor' ),
88 $this->get_url( '/assets/build/editor.js' ),
89 $script_asset['dependencies'],
90 $script_asset['version'],
91 true
92 );
93 }
94
95 /** @noinspection PhpUnhandledExceptionInspection */
96 private function get_dir( string $path = '' ): string {
97 /** @var Jet_Engine $compat */
98 $compat = jet_form_builder()->compat( Jet_Engine::class );
99
100 return $compat->get_dir( 'blocks/check-mark' . $path );
101 }
102
103 /** @noinspection PhpUnhandledExceptionInspection */
104 private function get_url( string $path ): string {
105 /** @var Jet_Engine $compat */
106 $compat = jet_form_builder()->compat( Jet_Engine::class );
107
108 return $compat->get_url( 'blocks/check-mark' . $path );
109 }
110
111 /** @noinspection PhpUnhandledExceptionInspection */
112 private function get_handle( string $prefix ): string {
113 /** @var Jet_Engine $compat */
114 $compat = jet_form_builder()->compat( Jet_Engine::class );
115
116 return $compat->get_handle( $prefix );
117 }
118 }
119