PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.9.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.9.1
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.9.1, at includes/Core/Util/GutenBlockProvider.php

53 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 {
9 public function register()
10 {
11 if (!function_exists('register_block_type')) {
12 return;
13 }
14
15 add_action('enqueue_block_editor_assets', [$this, 'shortcodeBlock']);
16 }
17
18 public function shortcodeBlock()
19 {
20 wp_enqueue_script(
21 'bitforms-runtime',
22 BITFORMS_ROOT_URI . '/v1/assets/js/runtime.js',
23 null,
24 BITFORMS_VERSION,
25 true
26 );
27 wp_enqueue_script(
28 'bitforms-gutenberg-block',
29 BITFORMS_ROOT_URI . '/v1/assets/js/bitforms-shortcode-block.js',
30 ['bitforms-runtime', 'wp-blocks', 'wp-i18n', 'wp-components'],
31 BITFORMS_VERSION,
32 true
33 );
34
35 /* wp_register_style(
36 'bitforms-gutenberg-block',
37 plugins_url('style.css', __FILE__),
38 array( ),
39 filemtime(plugin_dir_path(__FILE__) . 'style.css')
40 ); */
41 $formHandler = FormHandler::getInstance();
42 $all_forms = $formHandler->admin->getAllForm();
43 $bitformsForms = apply_filters(
44 'bitforms_localize_block_script',
45 [
46 'forms' => $all_forms
47 ]
48 );
49
50 wp_localize_script('bitforms-gutenberg-block', 'bitformsBlock', $bitformsForms);
51 }
52 }
53