PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.0-dev2
Elementor Website Builder – more than just a page builder v4.1.0-dev2
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 / design-system-sync / module.php

module.php in Elementor Website Builder – more than just a page builder 4.1.0-dev2, at modules/design-system-sync/module.php

76 lines 2.1 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\DesignSystemSync;
4
5 use Elementor\Core\Base\Module as BaseModule;
6 use Elementor\Modules\DesignSystemSync\Classes\Stylesheet_Manager;
7 use Elementor\Modules\DesignSystemSync\Classes\Controller;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 class Module extends BaseModule {
14 const MODULE_NAME = 'design-system-sync';
15 public static function get_v3_sync_id( string $label ): string {
16 return 'v4-' . strtolower( $label );
17 }
18
19 public function get_name() {
20 return self::MODULE_NAME;
21 }
22
23 public function __construct() {
24 parent::__construct();
25
26 $this->register_hooks();
27 }
28
29 private function register_hooks() {
30 ( new Classes\Global_Colors_Extension() )->register_hooks();
31 ( new Classes\Global_Typography_Extension() )->register_hooks();
32 ( new Controller() )->register_hooks();
33
34 add_action( 'elementor/controls/register', [ $this, 'register_controls' ] );
35 add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_editor_scripts' ] );
36 add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_editor_styles' ] );
37 add_action( 'elementor/global_classes/update', [ $this, 'clear_classes_cache' ] );
38 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_sync_stylesheet' ] );
39 }
40
41 public function register_controls( $controls_manager ) {
42 require_once __DIR__ . '/controls/v4-color-variable-list.php';
43 require_once __DIR__ . '/controls/v4-typography-list.php';
44
45 $controls_manager->register( new Controls\V4_Color_Variable_List() );
46 $controls_manager->register( new Controls\V4_Typography_List() );
47 }
48
49 public function enqueue_editor_scripts() {
50 wp_enqueue_script(
51 'elementor-design-system-sync-editor',
52 $this->get_js_assets_url( 'design-system-sync' ),
53 [],
54 ELEMENTOR_VERSION,
55 true
56 );
57 }
58
59 public function enqueue_editor_styles() {
60 wp_enqueue_style(
61 'elementor-design-system-sync-editor',
62 $this->get_css_assets_url( 'modules/design-system-sync/design-system-sync' ),
63 [],
64 ELEMENTOR_VERSION
65 );
66 }
67
68 public function clear_classes_cache() {
69 Classes\Classes_Provider::clear_cache();
70 }
71
72 public function enqueue_sync_stylesheet() {
73 ( new Stylesheet_Manager() )->enqueue();
74 }
75 }
76