PluginProbe
Elementor Website Builder – more than just a page builder / 3.31.2
Elementor Website Builder – more than just a page builder v3.31.2
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 +16 -49 4.3.0-beta23.31.2 View file →
@@ -2,30 +2,35 @@
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 -use Elementor\Modules\Variables\Classes\Variable_Types_Registry;
8 -use Elementor\Modules\Variables\ImportExportCustomization\Import_Export_Customization;
9 -use Elementor\Modules\Variables\PropTypes\Color_Variable_Prop_Type;
10 -use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
11 -use Elementor\Modules\Variables\Storage\Constants;
12 8 use Elementor\Plugin;
13 9
14 10 if ( ! defined( 'ABSPATH' ) ) {
15 - exit;
11 + exit; // Exit if accessed directly.
16 12 }
17 13
18 14 class Module extends BaseModule {
19 15 const MODULE_NAME = 'e-variables';
20 - const EXPERIMENT_NAME = AtomicWidgetsModule::EXPERIMENT_NAME;
16 + const EXPERIMENT_NAME = 'e_variables';
21 17
22 - private Variable_Types_Registry $variable_types_registry;
23 -
24 18 public function get_name() {
25 19 return self::MODULE_NAME;
26 20 }
27 21
22 + public static function get_experimental_data(): array {
23 + return [
24 + 'name' => self::EXPERIMENT_NAME,
25 + 'title' => esc_html__( 'Variables', 'elementor' ),
26 + 'description' => esc_html__( 'Enable variables. (For this feature to work - Atomic Widgets must be active)', 'elementor' ),
27 + 'hidden' => true,
28 + 'default' => ExperimentsManager::STATE_ACTIVE,
29 + 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
30 + ];
31 + }
32 +
28 33 private function hooks() {
29 34 return new Hooks();
30 35 }
31 36
@@ -36,49 +41,11 @@
36 41 return;
37 42 }
38 43
39 44 $this->hooks()->register();
40 -
41 - ( new Import_Export_Customization() )->register_hooks();
42 -
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' ] );
45 - add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() );
46 45 }
47 46
48 47 private function is_experiment_active(): bool {
49 - return Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
50 - }
51 -
52 - public function init_variable_types_registry(): void {
53 - $this->variable_types_registry = new Variable_Types_Registry();
54 -
55 - do_action( 'elementor/variables/register', $this->variable_types_registry );
56 - }
57 -
58 -
59 - public function get_variable_types_registry(): Variable_Types_Registry {
60 - return $this->variable_types_registry;
61 - }
62 -
63 - private function get_quota_config(): array {
64 - return [
65 - Color_Variable_Prop_Type::get_key() => 100000,
66 - Font_Variable_Prop_Type::get_key() => 100000,
67 - ];
68 - }
69 -
70 - public function enqueue_editor_scripts() {
71 -
72 - wp_add_inline_script(
73 - 'elementor-common',
74 - 'window.ElementorVariablesQuotaConfig = ' . wp_json_encode( $this->get_quota_config() ) . ';',
75 - 'before'
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 - ] );
48 + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME )
49 + && Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
83 50 }
84 51 }