PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Core / Util / GutenBlockProvider.php

GutenBlockProvider.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.0, at includes/Core/Util/GutenBlockProvider.php

50 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Core\Util;
4
5 use BitCode\BitForm\Core\Form\FormHandler;
6
7 final class GutenBlockProvider {
8 public function register() {
9 if (!function_exists('register_block_type')) {
10 return;
11 }
12
13 add_action('enqueue_block_editor_assets', [$this, 'shortcodeBlock']);
14 }
15
16 public function shortcodeBlock() {
17 wp_enqueue_script(
18 'bitforms-runtime',
19 BITFORMS_ASSET_URI . '/js/runtime.js',
20 null,
21 BITFORMS_VERSION,
22 true
23 );
24 wp_enqueue_script(
25 'bitforms-gutenberg-block',
26 BITFORMS_ASSET_URI . '/js/bitforms-shortcode-block.js',
27 ['bitforms-runtime', 'wp-blocks', 'wp-i18n', 'wp-components'],
28 BITFORMS_VERSION,
29 true
30 );
31
32 /* wp_register_style(
33 'bitforms-gutenberg-block',
34 plugins_url('style.css', __FILE__),
35 array( ),
36 filemtime(plugin_dir_path(__FILE__) . 'style.css')
37 ); */
38 $formHandler = FormHandler::getInstance();
39 $all_forms = $formHandler->admin->getAllForm();
40 $bitformsForms = apply_filters(
41 'bitforms_localize_block_script',
42 [
43 'forms' => $all_forms
44 ]
45 );
46
47 wp_localize_script('bitforms-gutenberg-block', 'bitformsBlock', $bitformsForms);
48 }
49 }
50