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 / map-field / block-asset.php
jetformbuilder / compatibility / jet-engine / blocks / map-field Last commit date
assets 1 year ago block-asset.php 1 year ago block-parser.php 1 year ago block-render.php 1 year ago block-template.php 1 year ago block-type.php 1 year ago block.json 1 year ago tools.php 1 year ago
block-asset.php
127 lines
1 <?php
2
3 namespace JFB_Compatibility\Jet_Engine\Blocks\Map_Field;
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 'jet-form-builder/editor-assets/before',
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 /** @var Jet_Engine $compat */
33 $compat = jet_form_builder()->compat( Jet_Engine::class );
34 $script_asset = require_once $compat->get_dir( 'blocks/map-field/assets/build/frontend/map.asset.php' );
35
36 if ( true === $script_asset ) {
37 return;
38 }
39
40 $handle = $compat->get_handle( 'map-field' );
41
42 array_push(
43 $script_asset['dependencies'],
44 Module::MAIN_SCRIPT_HANDLE
45 );
46
47 wp_register_script(
48 $handle,
49 $compat->get_url( 'blocks/map-field/assets/build/frontend/map.js' ),
50 $script_asset['dependencies'],
51 $script_asset['version'],
52 true
53 );
54
55 wp_register_style(
56 $handle,
57 $compat->get_url( 'blocks/map-field/assets/build/frontend/map.css' ),
58 array(),
59 $script_asset['version']
60 );
61
62 $script_asset = require_once $compat->get_dir(
63 'blocks/map-field/assets/build/frontend/autocomplete.asset.php'
64 );
65
66 wp_register_script(
67 $handle . '-autocomplete',
68 $compat->get_url( 'blocks/map-field/assets/build/frontend/autocomplete.js' ),
69 $script_asset['dependencies'],
70 $script_asset['version'],
71 true
72 );
73
74 wp_register_style(
75 $handle . '-autocomplete',
76 $compat->get_url( 'blocks/map-field/assets/build/frontend/autocomplete.css' ),
77 array(),
78 $script_asset['version']
79 );
80
81 wp_localize_script(
82 $handle,
83 'JetMapFieldsSettings',
84 array(
85 'api' => jet_engine()->api->get_route( 'get-map-point-data' ),
86 'apiHash' => jet_engine()->api->get_route( 'get-map-location-hash' ),
87 'apiLocation' => jet_engine()->api->get_route( 'get-map-location-data' ),
88 'apiAutocomplete' => jet_engine()->api->get_route( 'get-map-autocomplete-data' ),
89 'nonce' => wp_create_nonce( 'jet-map-field' ),
90 'i18n' => array(
91 'loading' => esc_html__( 'Loading ...', 'jet-form-builder' ),
92 'notFound' => esc_html__( 'Address not found', 'jet-form-builder' ),
93 ),
94 )
95 );
96 }
97
98 /**
99 * @return void
100 * @throws Repository_Exception
101 */
102 public function enqueue_editor_assets() {
103 /** @var Jet_Engine $compat */
104 $compat = jet_form_builder()->compat( Jet_Engine::class );
105 $script_asset = require_once $compat->get_dir( 'blocks/map-field/assets/build/editor.asset.php' );
106 $handle = $compat->get_handle( 'map-field-editor' );
107
108 wp_enqueue_script(
109 $handle,
110 $compat->get_url( 'blocks/map-field/assets/build/editor.js' ),
111 $script_asset['dependencies'],
112 $script_asset['version'],
113 true
114 );
115
116 wp_localize_script(
117 $handle,
118 'JetFBMapField',
119 array(
120 'formats' => Tools::get_formats(),
121 'is_supported' => Tools::is_supported(),
122 'help' => Tools::get_help_message(),
123 )
124 );
125 }
126 }
127