PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.2
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 / woocommerce / woocommerce.php
jetformbuilder / compatibility / woocommerce Last commit date
assets 1 month ago methods 1 year ago woocommerce.php 2 years ago
woocommerce.php
73 lines
1 <?php
2
3
4 namespace JFB_Compatibility\Woocommerce;
5
6 use JFB_Compatibility\Woocommerce\Methods\Wc_Product_Modification\Wc_Product_Modifier;
7 use JFB_Components\Compatibility\Base_Compat_Dir_Trait;
8 use JFB_Components\Compatibility\Base_Compat_Handle_Trait;
9 use JFB_Components\Compatibility\Base_Compat_Url_Trait;
10 use JFB_Components\Module\Base_Module_Dir_It;
11 use JFB_Components\Module\Base_Module_Handle_It;
12 use JFB_Components\Module\Base_Module_It;
13 use JFB_Components\Module\Base_Module_Url_It;
14
15 // If this file is called directly, abort.
16 if ( ! defined( 'WPINC' ) ) {
17 die;
18 }
19
20 class Woocommerce implements
21 Base_Module_Url_It,
22 Base_Module_It,
23 Base_Module_Handle_It,
24 Base_Module_Dir_It {
25
26 use Base_Compat_Url_Trait;
27 use Base_Compat_Handle_Trait;
28 use Base_Compat_Dir_Trait;
29
30 public function rep_item_id() {
31 return 'woocommerce';
32 }
33
34 public function condition(): bool {
35 return function_exists( 'WC' );
36 }
37
38 public function init_hooks() {
39 add_filter(
40 'jet-form-builder/action/insert-post/modifiers',
41 array( $this, 'add_modifiers' )
42 );
43 add_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) );
44 }
45
46 public function remove_hooks() {
47 remove_filter(
48 'jet-form-builder/action/insert-post/modifiers',
49 array( $this, 'add_modifiers' )
50 );
51 remove_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) );
52 }
53
54 public function add_modifiers( array $modifiers ): array {
55 $modifiers[] = new Wc_Product_Modifier();
56
57 return $modifiers;
58 }
59
60 public function enqueue_admin_assets() {
61 $script_asset = require_once $this->get_dir( 'assets/build/editor.asset.php' );
62
63 wp_enqueue_script(
64 $this->get_handle(),
65 $this->get_url( 'assets/build/editor.js' ),
66 $script_asset['dependencies'],
67 $script_asset['version'],
68 true
69 );
70 }
71
72 }
73