PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.7
JetFormBuilder — Dynamic Blocks Form Builder v3.4.7
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 / modules / wysiwyg / module.php
jetformbuilder / modules / wysiwyg Last commit date
assets 1 year ago blocks 2 years ago module.php 2 years ago
module.php
114 lines
1 <?php
2
3
4 namespace JFB_Modules\Wysiwyg;
5
6 use Jet_Form_Builder\Blocks\Module as BlocksModule;
7 use Jet_Form_Builder\Plugin;
8 use JFB_Components\Module\Base_Module_Dir_It;
9 use JFB_Components\Module\Base_Module_Dir_Trait;
10 use JFB_Components\Module\Base_Module_Handle_It;
11 use JFB_Components\Module\Base_Module_Handle_Trait;
12 use JFB_Components\Module\Base_Module_It;
13 use JFB_Components\Module\Base_Module_Url_It;
14 use JFB_Components\Module\Base_Module_Url_Trait;
15
16 // If this file is called directly, abort.
17 if ( ! defined( 'WPINC' ) ) {
18 die;
19 }
20
21 final class Module implements
22 Base_Module_It,
23 Base_Module_Url_It,
24 Base_Module_Handle_It,
25 Base_Module_Dir_It {
26
27 use Base_Module_Url_Trait;
28 use Base_Module_Dir_Trait;
29 use Base_Module_Handle_Trait;
30
31 public function rep_item_id() {
32 return 'wysiwyg';
33 }
34
35 public function condition(): bool {
36 return true;
37 }
38
39 public function init_hooks() {
40 add_filter( 'jet-form-builder/blocks/items', array( $this, 'add_blocks_types' ) );
41 add_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) );
42 add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_scripts' ) );
43 add_action( 'jet_plugins/frontend/register_scripts', array( $this, 'register_frontend_scripts' ) );
44 }
45
46 public function remove_hooks() {
47 remove_filter( 'jet-form-builder/blocks/items', array( $this, 'add_blocks_types' ) );
48 remove_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) );
49 remove_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_scripts' ) );
50 remove_action( 'jet_plugins/frontend/register_scripts', array( $this, 'register_frontend_scripts' ) );
51 }
52
53 public function add_blocks_types( array $block_types ): array {
54 $block_types[] = new Blocks\Wysiwyg\Block_Type();
55
56 return $block_types;
57 }
58
59 public function enqueue_admin_assets() {
60 $script_asset = require_once $this->get_dir( 'assets/build/editor.asset.php' );
61
62 wp_enqueue_script(
63 $this->get_handle(),
64 $this->get_url( 'assets/build/editor.js' ),
65 $script_asset['dependencies'],
66 $script_asset['version'],
67 true
68 );
69
70 wp_enqueue_style(
71 $this->get_handle( 'lightgray-skin' ),
72 includes_url( 'js/tinymce/skins/lightgray/skin.min.css' ),
73 array(),
74 $script_asset['version']
75 );
76
77 wp_enqueue_style(
78 $this->get_handle(),
79 $this->get_url( 'assets/build/wysiwyg.css' ),
80 array(
81 'editor-buttons',
82 ),
83 $script_asset['version']
84 );
85 }
86
87 public function register_frontend_scripts() {
88 $script_asset = require_once $this->get_dir( 'assets/build/wysiwyg.asset.php' );
89
90 if ( true === $script_asset ) {
91 return;
92 }
93
94 array_push(
95 $script_asset['dependencies'],
96 BlocksModule::MAIN_SCRIPT_HANDLE
97 );
98
99 wp_register_script(
100 $this->get_handle(),
101 $this->get_url( 'assets/build/wysiwyg.js' ),
102 $script_asset['dependencies'],
103 $script_asset['version'],
104 true
105 );
106 wp_register_style(
107 $this->get_handle(),
108 $this->get_url( 'assets/build/wysiwyg.css' ),
109 array(),
110 $script_asset['version']
111 );
112 }
113 }
114