| @@ -2,15 +2,18 @@ | ||
| 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; |
| 12 | +use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type; | |
| 11 | 13 | use Elementor\Modules\Variables\Storage\Constants; |
| 12 | 14 | use Elementor\Plugin; |
| 15 | +use Elementor\Utils; | |
| 13 | 16 | |
| 14 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | 18 | exit; |
| 16 | 19 | } |
| @@ -16,9 +19,10 @@ | ||
| 16 | 19 | } |
| 17 | 20 | |
| 18 | 21 | class Module extends BaseModule { |
| 19 | 22 | const MODULE_NAME = 'e-variables'; |
| 20 | - const EXPERIMENT_NAME = AtomicWidgetsModule::EXPERIMENT_NAME; | |
| 23 | + const EXPERIMENT_NAME = 'e_variables'; | |
| 24 | + const EXPERIMENT_MANAGER_NAME = 'e_variables_manager'; | |
| 21 | 25 | |
| 22 | 26 | private Variable_Types_Registry $variable_types_registry; |
| 23 | 27 | |
| 24 | 28 | public function get_name() { |
| @@ -24,8 +28,19 @@ | ||
| 24 | 28 | public function get_name() { |
| 25 | 29 | return self::MODULE_NAME; |
| 26 | 30 | } |
| 27 | 31 | |
| 32 | + public static function get_experimental_data(): array { | |
| 33 | + return [ | |
| 34 | + 'name' => self::EXPERIMENT_NAME, | |
| 35 | + 'title' => esc_html__( 'Variables', 'elementor' ), | |
| 36 | + 'description' => esc_html__( 'Enable variables. (For this feature to work - Atomic Widgets must be active)', 'elementor' ), | |
| 37 | + 'hidden' => true, | |
| 38 | + 'default' => ExperimentsManager::STATE_ACTIVE, | |
| 39 | + 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA, | |
| 40 | + ]; | |
| 41 | + } | |
| 42 | + | |
| 28 | 43 | private function hooks() { |
| 29 | 44 | return new Hooks(); |
| 30 | 45 | } |
| 31 | 46 | |
| @@ -34,8 +49,9 @@ | ||
| 34 | 49 | |
| 35 | 50 | if ( ! $this->is_experiment_active() ) { |
| 36 | 51 | return; |
| 37 | 52 | } |
| 53 | + $this->register_features(); | |
| 38 | 54 | |
| 39 | 55 | $this->hooks()->register(); |
| 40 | 56 | |
| 41 | 57 | ( new Import_Export_Customization() )->register_hooks(); |
| @@ -44,10 +60,22 @@ | ||
| 44 | 60 | add_filter( 'elementor/kit/meta_to_preserve_on_kit_import', [ $this, 'add_meta_to_preserve_on_kit_import' ] ); |
| 45 | 61 | add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() ); |
| 46 | 62 | } |
| 47 | 63 | |
| 64 | + private function register_features() { | |
| 65 | + Plugin::$instance->experiments->add_feature([ | |
| 66 | + 'name' => self::EXPERIMENT_MANAGER_NAME, | |
| 67 | + 'title' => esc_html__( 'Variables Manager', 'elementor' ), | |
| 68 | + 'description' => esc_html__( 'Enable variables manager. (For this feature to work - Variables must be active)', 'elementor' ), | |
| 69 | + 'hidden' => true, | |
| 70 | + 'default' => ExperimentsManager::STATE_ACTIVE, | |
| 71 | + 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA, | |
| 72 | + ]); | |
| 73 | + } | |
| 74 | + | |
| 48 | 75 | private function is_experiment_active(): bool { |
| 49 | - return Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME ); | |
| 76 | + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) | |
| 77 | + && Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME ); | |
| 50 | 78 | } |
| 51 | 79 | |
| 52 | 80 | public function init_variable_types_registry(): void { |
| 53 | 81 | $this->variable_types_registry = new Variable_Types_Registry(); |