PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.8
Elementor Website Builder – more than just a page builder v3.35.8
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/home/module.php +34 -1 4.0.83.35.8 View file →
@@ -1,8 +1,10 @@
1 1 <?php
2 2 namespace Elementor\Modules\Home;
3 3
4 +use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
4 5 use Elementor\Core\Base\App as BaseApp;
6 +use Elementor\Core\Experiments\Manager as Experiments_Manager;
5 7 use Elementor\Includes\EditorAssetsAPI;
6 8 use Elementor\Settings;
7 9 use Elementor\Plugin;
8 10 use Elementor\Utils;
@@ -21,8 +23,17 @@
21 23
22 24 public function __construct() {
23 25 parent::__construct();
24 26
27 + if ( ! $this->is_experiment_active() ) {
28 + return;
29 + }
30 +
31 + add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) {
32 + $hook_suffix = 'toplevel_page_elementor';
33 + add_action( "admin_print_scripts-{$hook_suffix}", [ $this, 'enqueue_home_screen_scripts' ] );
34 + }, 10, 2 );
35 +
25 36 add_filter( 'elementor/document/urls/edit', [ $this, 'add_active_document_to_edit_link' ] );
26 37 }
27 38
28 39 public function enqueue_home_screen_scripts(): void {
@@ -52,8 +63,12 @@
52 63 'elementorHomeScreenData',
53 64 $this->get_app_js_config()
54 65 );
55 66
67 + if ( ! Plugin::$instance->experiments->is_feature_active( 'e_editor_one' ) ) {
68 + return;
69 + }
70 +
56 71 wp_enqueue_style(
57 72 'e-home-screen',
58 73 $this->get_css_assets_url( 'modules/home/e-home-screen' ),
59 74 [],
@@ -60,8 +75,12 @@
60 75 ELEMENTOR_VERSION
61 76 );
62 77 }
63 78
79 + public function is_experiment_active(): bool {
80 + return Plugin::$instance->experiments->is_feature_active( self::PAGE_ID );
81 + }
82 +
64 83 public function add_active_document_to_edit_link( $edit_link ) {
65 84 $active_document = Utils::get_super_global_value( $_GET, 'active-document' ) ?? null;
66 85 $active_tab = Utils::get_super_global_value( $_GET, 'active-tab' ) ?? null;
67 86
@@ -75,13 +94,25 @@
75 94
76 95 return $edit_link;
77 96 }
78 97
98 + public static function get_experimental_data(): array {
99 + return [
100 + 'name' => static::PAGE_ID,
101 + 'title' => esc_html__( 'Elementor Home Screen', 'elementor' ),
102 + 'description' => esc_html__( 'Default Elementor menu page.', 'elementor' ),
103 + 'hidden' => true,
104 + 'release_status' => Experiments_Manager::RELEASE_STATUS_STABLE,
105 + 'default' => Experiments_Manager::STATE_ACTIVE,
106 + ];
107 + }
108 +
79 109 private function get_app_js_config(): array {
80 110 $editor_assets_api = new EditorAssetsAPI( $this->get_api_config() );
81 111 $api = new API( $editor_assets_api );
82 112
83 113 $config = $api->get_home_screen_items();
114 + $config['isEditorOneActive'] = Plugin::$instance->experiments->is_feature_active( 'e_editor_one' );
84 115
85 116 return $config;
86 117 }
87 118
@@ -93,7 +124,9 @@
93 124 ];
94 125 }
95 126
96 127 public static function get_elementor_settings_page_id(): string {
97 - return 'elementor-settings';
128 + return Plugin::$instance->experiments->is_feature_active( self::PAGE_ID )
129 + ? 'elementor-settings'
130 + : Settings::PAGE_ID;
98 131 }
99 132 }