module.php
5 months ago
opt-in-page.php
2 months ago
panel-chip.php
9 months ago
welcome-screen.php
2 months ago
module.php
55 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor\Modules\AtomicOptIn; |
| 4 | |
| 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | use Elementor\Core\Experiments\Manager as Experiments_Manager; |
| 7 | use Elementor\Modules\AtomicWidgets\OptIn\Opt_In as Atomic_Widgets_Opt_In; |
| 8 | use Elementor\Plugin; |
| 9 | |
| 10 | class Module extends BaseModule { |
| 11 | const EXPERIMENT_NAME = 'e_opt_in_v4_page'; |
| 12 | const MODULE_NAME = 'editor-v4-opt-in'; |
| 13 | const WELCOME_POPOVER_DISPLAYED_OPTION = '_e_welcome_popover_displayed'; |
| 14 | |
| 15 | public function get_name() { |
| 16 | return 'atomic-opt-in'; |
| 17 | } |
| 18 | |
| 19 | public static function get_experimental_data(): array { |
| 20 | return [ |
| 21 | 'name' => self::EXPERIMENT_NAME, |
| 22 | 'title' => esc_html__( 'Editor v4 (Opt In Page)', 'elementor' ), |
| 23 | 'description' => esc_html__( 'Enable the settings Opt In page', 'elementor' ), |
| 24 | 'hidden' => true, |
| 25 | 'default' => Experiments_Manager::STATE_ACTIVE, |
| 26 | 'release_status' => Experiments_Manager::RELEASE_STATUS_ALPHA, |
| 27 | ]; |
| 28 | } |
| 29 | |
| 30 | public function get_opt_in_css_assets_url( string $path ) { |
| 31 | return $this->get_css_assets_url( $path ); |
| 32 | } |
| 33 | |
| 34 | public function __construct() { |
| 35 | ( new PanelChip() )->init(); |
| 36 | |
| 37 | if ( ! Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) ) { |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | ( new Atomic_Widgets_Opt_In() )->init(); |
| 42 | ( new OptInPage( $this ) )->init(); |
| 43 | |
| 44 | if ( ! $this->is_atomic_experiment_active() ) { |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | ( new WelcomeScreen() )->init(); |
| 49 | } |
| 50 | |
| 51 | public function is_atomic_experiment_active(): bool { |
| 52 | return Plugin::$instance->experiments->is_feature_active( Atomic_Widgets_Opt_In::EXPERIMENT_NAME ); |
| 53 | } |
| 54 | } |
| 55 |