PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.3
Elementor Website Builder – more than just a page builder v4.2.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / wc-product-editor / module.php

module.php in Elementor Website Builder – more than just a page builder 4.2.3, at modules/wc-product-editor/module.php

58 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\WcProductEditor;
4
5 use Elementor\Core\Base\Module as BaseModule;
6 use Elementor\Plugin;
7 use Elementor\Utils;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 class Module extends BaseModule {
14
15 public function __construct() {
16 add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_assets' ] );
17 }
18
19 public static function is_active() {
20 return self::is_new_woocommerce_product_editor_page();
21 }
22
23 public function enqueue_assets() {
24 $suffix = Utils::is_script_debug() ? '' : '.min';
25
26 wp_enqueue_script(
27 'e-wc-product-editor',
28 ELEMENTOR_ASSETS_URL . 'js/e-wc-product-editor' . $suffix . '.js',
29 [ 'wp-components', 'wp-core-data', 'wc-admin-layout', 'wp-plugins' ],
30 ELEMENTOR_VERSION,
31 true
32 );
33
34 $elementor_settings = [
35 'editLink' => admin_url( 'post.php' ),
36 ];
37 Utils::print_js_config( 'e-wc-product-editor', 'ElementorWCProductEditorSettings', $elementor_settings );
38 }
39
40 public function get_name() {
41 return 'wc-product-editor';
42 }
43
44 public static function is_new_woocommerce_product_editor_page() {
45 $page = Utils::get_super_global_value( $_GET, 'page' );
46 $path = Utils::get_super_global_value( $_GET, 'path' );
47
48 if ( ! isset( $page ) || 'wc-admin' !== $page || ! isset( $path ) ) {
49 return false;
50 }
51
52 $path_pieces = explode( '/', $path );
53 $route = $path_pieces[1];
54
55 return 'product' === $route || 'add-product' === $route;
56 }
57 }
58