PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.2
Elementor Website Builder – more than just a page builder v3.30.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/home/module.php +31 -23 4.2.23.30.2 View file →
@@ -1,9 +1,13 @@
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;
8 +use Elementor\Settings;
9 +use Elementor\Plugin;
6 10 use Elementor\Utils;
7 11
8 12 if ( ! defined( 'ABSPATH' ) ) {
9 13 exit; // Exit if accessed directly.
@@ -19,27 +23,25 @@
19 23
20 24 public function __construct() {
21 25 parent::__construct();
22 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 +
23 36 add_filter( 'elementor/document/urls/edit', [ $this, 'add_active_document_to_edit_link' ] );
24 37 }
25 38
26 - public function enqueue_fonts(): void {
27 - wp_enqueue_style(
28 - 'elementor-home-screen-fonts',
29 - 'https://fonts.googleapis.com/css2?family=Poppins:wght@400&display=swap',
30 - [],
31 - ELEMENTOR_VERSION
32 - );
33 - }
34 -
35 39 public function enqueue_home_screen_scripts(): void {
36 40 if ( ! current_user_can( 'manage_options' ) ) {
37 41 return;
38 42 }
39 43
40 - $this->enqueue_fonts();
41 -
42 44 $min_suffix = Utils::is_script_debug() ? '' : '.min';
43 45
44 46 wp_enqueue_script(
45 47 'e-home-screen',
@@ -60,15 +62,12 @@
60 62 'e-home-screen',
61 63 'elementorHomeScreenData',
62 64 $this->get_app_js_config()
63 65 );
66 + }
64 67
65 - wp_enqueue_style(
66 - 'e-home-screen',
67 - $this->get_css_assets_url( 'modules/home/e-home-screen' ),
68 - [],
69 - ELEMENTOR_VERSION
70 - );
68 + public function is_experiment_active(): bool {
69 + return Plugin::$instance->experiments->is_feature_active( self::PAGE_ID );
71 70 }
72 71
73 72 public function add_active_document_to_edit_link( $edit_link ) {
74 73 $active_document = Utils::get_super_global_value( $_GET, 'active-document' ) ?? null;
@@ -84,17 +83,24 @@
84 83
85 84 return $edit_link;
86 85 }
87 86
87 + public static function get_experimental_data(): array {
88 + return [
89 + 'name' => static::PAGE_ID,
90 + 'title' => esc_html__( 'Elementor Home Screen', 'elementor' ),
91 + 'description' => esc_html__( 'Default Elementor menu page.', 'elementor' ),
92 + 'hidden' => true,
93 + 'release_status' => Experiments_Manager::RELEASE_STATUS_STABLE,
94 + 'default' => Experiments_Manager::STATE_ACTIVE,
95 + ];
96 + }
97 +
88 98 private function get_app_js_config(): array {
89 99 $editor_assets_api = new EditorAssetsAPI( $this->get_api_config() );
90 100 $api = new API( $editor_assets_api );
91 101
92 - $config = $api->get_home_screen_items();
93 -
94 - $config['wpRestNonce'] = wp_create_nonce( 'wp_rest' );
95 -
96 - return $config;
102 + return $api->get_home_screen_items();
97 103 }
98 104
99 105 private function get_api_config(): array {
100 106 return [
@@ -104,7 +110,9 @@
104 110 ];
105 111 }
106 112
107 113 public static function get_elementor_settings_page_id(): string {
108 - return 'elementor-settings';
114 + return Plugin::$instance->experiments->is_feature_active( self::PAGE_ID )
115 + ? 'elementor-settings'
116 + : Settings::PAGE_ID;
109 117 }
110 118 }