PluginProbe
Elementor Website Builder – more than just a page builder / 3.7.5
Elementor Website Builder – more than just a page builder v3.7.5
4.3.0-beta3 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 All 452 releases
← All changes | core/common/modules/connect/admin.php +6 -47 3.7.43.7.5 View file →
@@ -1,7 +1,8 @@
1 1 <?php
2 2 namespace Elementor\Core\Common\Modules\Connect;
3 3
4 +use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
4 5 use Elementor\Plugin;
5 6 use Elementor\Settings;
6 7
7 8 if ( ! defined( 'ABSPATH' ) ) {
@@ -17,27 +18,14 @@
17 18 /**
18 19 * @since 2.3.0
19 20 * @access public
20 21 */
21 - public function register_admin_menu() {
22 - $submenu_page = add_submenu_page(
23 - Settings::PAGE_ID,
24 - __( 'Connect', 'elementor' ),
25 - __( 'Connect', 'elementor' ),
26 - 'edit_posts',
27 - self::PAGE_ID,
28 - [ $this, 'render_page' ]
29 - );
22 + public function register_admin_menu( Admin_Menu_Manager $admin_menu ) {
30 23
31 - add_action( 'load-' . $submenu_page, [ $this, 'on_load_page' ] );
32 - }
24 + $admin_menu->register( static::PAGE_ID, new Connect_Menu_Item() );
33 25
34 - /**
35 - * @since 2.3.0
36 - * @access public
37 - */
38 - public function hide_menu_item() {
39 - remove_submenu_page( Settings::PAGE_ID, self::PAGE_ID );
26 + // TODO: Find a way to get the hook name from the register.
27 + add_action( 'load-elementor_page_' . static::PAGE_ID, [ $this, 'on_load_page' ] );
40 28 }
41 29
42 30 /**
43 31 * @since 2.3.0
@@ -71,39 +59,10 @@
71 59 /**
72 60 * @since 2.3.0
73 61 * @access public
74 62 */
75 - public function render_page() {
76 - $apps = Plugin::$instance->common->get_component( 'connect' )->get_apps();
77 - ?>
78 - <style>
79 - .elementor-connect-app-wrapper{
80 - margin-bottom: 50px;
81 - overflow: hidden;
82 - }
83 - </style>
84 - <div class="wrap">
85 - <?php
86 -
87 - /** @var \Elementor\Core\Common\Modules\Connect\Apps\Base_App $app */
88 - foreach ( $apps as $app ) {
89 - echo '<div class="elementor-connect-app-wrapper">';
90 - $app->render_admin_widget();
91 - echo '</div>';
92 - }
93 -
94 - ?>
95 - </div><!-- /.wrap -->
96 - <?php
97 - }
98 -
99 - /**
100 - * @since 2.3.0
101 - * @access public
102 - */
103 63 public function __construct() {
104 64 self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID );
105 65
106 - add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 206 );
107 - add_action( 'admin_head', [ $this, 'hide_menu_item' ] );
66 + add_action( 'elementor/admin/menu/register', [ $this, 'register_admin_menu' ] );
108 67 }
109 68 }