PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.9
Elementor Website Builder – more than just a page builder v4.0.9
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
← All changes | modules/variables/module.php +30 -10 4.3.0-beta14.0.9 View file →
@@ -2,15 +2,17 @@
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;
6 7 use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule;
7 8 use Elementor\Modules\Variables\Classes\Variable_Types_Registry;
8 9 use Elementor\Modules\Variables\ImportExportCustomization\Import_Export_Customization;
9 10 use Elementor\Modules\Variables\PropTypes\Color_Variable_Prop_Type;
10 11 use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
11 -use Elementor\Modules\Variables\Storage\Constants;
12 +use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
12 13 use Elementor\Plugin;
14 +use Elementor\Utils;
13 15
14 16 if ( ! defined( 'ABSPATH' ) ) {
15 17 exit;
16 18 }
@@ -16,9 +18,10 @@
16 18 }
17 19
18 20 class Module extends BaseModule {
19 21 const MODULE_NAME = 'e-variables';
20 - const EXPERIMENT_NAME = AtomicWidgetsModule::EXPERIMENT_NAME;
22 + const EXPERIMENT_NAME = 'e_variables';
23 + const EXPERIMENT_MANAGER_NAME = 'e_variables_manager';
21 24
22 25 private Variable_Types_Registry $variable_types_registry;
23 26
24 27 public function get_name() {
@@ -24,8 +27,19 @@
24 27 public function get_name() {
25 28 return self::MODULE_NAME;
26 29 }
27 30
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 +
28 42 private function hooks() {
29 43 return new Hooks();
30 44 }
31 45
@@ -34,8 +48,9 @@
34 48
35 49 if ( ! $this->is_experiment_active() ) {
36 50 return;
37 51 }
52 + $this->register_features();
38 53
39 54 $this->hooks()->register();
40 55
41 56 ( new Import_Export_Customization() )->register_hooks();
@@ -40,14 +55,25 @@
40 55
41 56 ( new Import_Export_Customization() )->register_hooks();
42 57
43 58 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' ] );
45 59 add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() );
46 60 }
47 61
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 +
48 73 private function is_experiment_active(): bool {
49 - return Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
74 + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME )
75 + && Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
50 76 }
51 77
52 78 public function init_variable_types_registry(): void {
53 79 $this->variable_types_registry = new Variable_Types_Registry();
@@ -73,12 +99,6 @@
73 99 'elementor-common',
74 100 'window.ElementorVariablesQuotaConfig = ' . wp_json_encode( $this->get_quota_config() ) . ';',
75 101 'before'
76 102 );
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 - ] );
83 103 }
84 104 }