| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Variables; |
| 4 |
|
| 5 |
use Elementor\Core\Base\Module as BaseModule; |
| 6 |
use Elementor\Core\Experiments\Manager as ExperimentsManager; |
| 7 |
use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule; |
| 8 |
use Elementor\Plugin; |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; // Exit if accessed directly. |
| 12 |
} |
| 13 |
|
| 14 |
class Module extends BaseModule { |
| 15 |
const MODULE_NAME = 'e-variables'; |
| 16 |
const EXPERIMENT_NAME = 'e_variables'; |
| 17 |
|
| 18 |
public function get_name() { |
| 19 |
return self::MODULE_NAME; |
| 20 |
} |
| 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_INACTIVE, |
| 29 |
'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA, |
| 30 |
]; |
| 31 |
} |
| 32 |
|
| 33 |
private function hooks() { |
| 34 |
return new Hooks(); |
| 35 |
} |
| 36 |
|
| 37 |
public function __construct() { |
| 38 |
parent::__construct(); |
| 39 |
|
| 40 |
if ( ! $this->is_experiment_active() ) { |
| 41 |
return; |
| 42 |
} |
| 43 |
|
| 44 |
$this->hooks()->register(); |
| 45 |
} |
| 46 |
|
| 47 |
private function is_experiment_active(): bool { |
| 48 |
return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) |
| 49 |
&& Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME ); |
| 50 |
} |
| 51 |
} |
| 52 |
|