PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 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 All 452 releases
← All changes | modules/variables/module.php +10 -30 4.0.94.3.0-beta3 View file →
@@ -2,17 +2,15 @@
2 2
3 3 namespace Elementor\Modules\Variables;
4 4
5 5 use Elementor\Core\Base\Module as BaseModule;
6 -use Elementor\Core\Experiments\Manager as ExperimentsManager;
7 6 use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule;
8 7 use Elementor\Modules\Variables\Classes\Variable_Types_Registry;
9 8 use Elementor\Modules\Variables\ImportExportCustomization\Import_Export_Customization;
10 9 use Elementor\Modules\Variables\PropTypes\Color_Variable_Prop_Type;
11 10 use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
12 -use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
11 +use Elementor\Modules\Variables\Storage\Constants;
13 12 use Elementor\Plugin;
14 -use Elementor\Utils;
15 13
16 14 if ( ! defined( 'ABSPATH' ) ) {
17 15 exit;
18 16 }
@@ -18,10 +16,9 @@
18 16 }
19 17
20 18 class Module extends BaseModule {
21 19 const MODULE_NAME = 'e-variables';
22 - const EXPERIMENT_NAME = 'e_variables';
23 - const EXPERIMENT_MANAGER_NAME = 'e_variables_manager';
20 + const EXPERIMENT_NAME = AtomicWidgetsModule::EXPERIMENT_NAME;
24 21
25 22 private Variable_Types_Registry $variable_types_registry;
26 23
27 24 public function get_name() {
@@ -27,19 +24,8 @@
27 24 public function get_name() {
28 25 return self::MODULE_NAME;
29 26 }
30 27
31 - public static function get_experimental_data(): array {
32 - return [
33 - 'name' => self::EXPERIMENT_NAME,
34 - 'title' => esc_html__( 'Variables', 'elementor' ),
35 - 'description' => esc_html__( 'Enable variables. (For this feature to work - Atomic Widgets must be active)', 'elementor' ),
36 - 'hidden' => true,
37 - 'default' => ExperimentsManager::STATE_ACTIVE,
38 - 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
39 - ];
40 - }
41 -
42 28 private function hooks() {
43 29 return new Hooks();
44 30 }
45 31
@@ -48,9 +34,8 @@
48 34
49 35 if ( ! $this->is_experiment_active() ) {
50 36 return;
51 37 }
52 - $this->register_features();
53 38
54 39 $this->hooks()->register();
55 40
56 41 ( new Import_Export_Customization() )->register_hooks();
@@ -55,25 +40,14 @@
55 40
56 41 ( new Import_Export_Customization() )->register_hooks();
57 42
58 43 add_action( 'init', [ $this, 'init_variable_types_registry' ] );
44 + add_filter( 'elementor/kit/meta_to_preserve_on_kit_import', [ $this, 'add_meta_to_preserve_on_kit_import' ] );
59 45 add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() );
60 46 }
61 47
62 - private function register_features() {
63 - Plugin::$instance->experiments->add_feature([
64 - 'name' => self::EXPERIMENT_MANAGER_NAME,
65 - 'title' => esc_html__( 'Variables Manager', 'elementor' ),
66 - 'description' => esc_html__( 'Enable variables manager. (For this feature to work - Variables must be active)', 'elementor' ),
67 - 'hidden' => true,
68 - 'default' => ExperimentsManager::STATE_ACTIVE,
69 - 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
70 - ]);
71 - }
72 -
73 48 private function is_experiment_active(): bool {
74 - return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME )
75 - && Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
49 + return Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
76 50 }
77 51
78 52 public function init_variable_types_registry(): void {
79 53 $this->variable_types_registry = new Variable_Types_Registry();
@@ -99,6 +73,12 @@
99 73 'elementor-common',
100 74 'window.ElementorVariablesQuotaConfig = ' . wp_json_encode( $this->get_quota_config() ) . ';',
101 75 'before'
102 76 );
77 + }
78 +
79 + public function add_meta_to_preserve_on_kit_import( array $meta_keys ): array {
80 + return array_merge( $meta_keys, [
81 + Constants::VARIABLES_META_KEY,
82 + ] );
103 83 }
104 84 }