Admin()
Methods
- __construct — Admin::__construct() Changelog Changelog Version Description 2.3.0 Introduced. Source core/common/modules/connect/admin.php public function __construct() { self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID ); add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 206 ); add_action( 'admin_head', [ $this, 'hide_menu_item' ] ); add_action( 'load-elementor_page_' . self::PAGE_ID, [ $this, 'on_load_page' ] ); } Used By core/common/modules/connect/module.php: Module::init()
- hide_menu_item — Admin::hide_menu_item() Changelog Changelog Version Description 2.3.0 Introduced. Source core/common/modules/connect/admin.php public function hide_menu_item() { remove_submenu_page( Settings::PAGE_ID, self::PAGE_ID ); }
- on_load_page — Admin::on_load_page() Changelog Changelog Version Description 2.3.0 Introduced. Source core/common/modules/connect/admin.php public function on_load_page() { if ( isset( $_GET['action'], $_GET['app'] ) ) { $manager = Plugin::$instance->common->get_component( 'connect' ); $app_slug = $_GET['app']; $app = $manager->get_app( $app_slug ); $nonce_action = $_GET['app'] . $_GET['action']; if ( ! $app ) { wp_die( 'Unknown app: ' . $app_slug ); } if ( […]
- register_admin_menu — Admin::register_admin_menu() Changelog Changelog Version Description 2.3.0 Introduced. Source core/common/modules/connect/admin.php public function register_admin_menu() { add_submenu_page( Settings::PAGE_ID, __( 'Connect', 'elementor' ), __( 'Connect', 'elementor' ), 'manage_options', self::PAGE_ID, [ $this, 'render_page' ] ); }
- render_page — Admin::render_page() Changelog Changelog Version Description 2.3.0 Introduced. Source core/common/modules/connect/admin.php public function render_page() { wp_enqueue_script( 'elementor-connect' ); $apps = Plugin::$instance->common->get_component( 'connect' )->get_apps(); ?> <style> .elementor-connect-app-wrapper{ margin-bottom: 50px; overflow: hidden; } </style> <div class="wrap"> <?php /** @var \Elementor\Core\Common\Modules\Connect\Apps\Base_App $app */ foreach ( $apps as $app ) { echo '<div class="elementor-connect-app-wrapper">'; $app->render_admin_widget(); echo '</div>'; } ?> </div><!-- /.wrap […]
Source
core/common/modules/connect/admin.php
class Admin { const PAGE_ID = 'elementor-connect'; public static $url = ''; public function register_admin_menu() { add_submenu_page( Settings::PAGE_ID, __( 'Connect', 'elementor' ), __( 'Connect', 'elementor' ), 'manage_options', self::PAGE_ID, [ $this, 'render_page' ] ); } public function hide_menu_item() { remove_submenu_page( Settings::PAGE_ID, self::PAGE_ID ); } public function on_load_page() { if ( isset( $_GET['action'], $_GET['app'] ) ) { $manager = Plugin::$instance->common->get_component( 'connect' ); $app_slug = $_GET['app']; $app = $manager->get_app( $app_slug ); $nonce_action = $_GET['app'] . $_GET['action']; if ( ! $app ) { wp_die( 'Unknown app: ' . $app_slug ); } if ( empty( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], $nonce_action ) ) { wp_die( 'Invalid Nonce', 'Invalid Nonce', [ 'back_link' => true, ] ); } $method = 'action_' . $_GET['action']; if ( method_exists( $app, $method ) ) { call_user_func( [ $app, $method ] ); } } } public function render_page() { wp_enqueue_script( 'elementor-connect' ); $apps = Plugin::$instance->common->get_component( 'connect' )->get_apps(); ?> <style> .elementor-connect-app-wrapper{ margin-bottom: 50px; overflow: hidden; } </style> <div class="wrap"> <?php /** @var \Elementor\Core\Common\Modules\Connect\Apps\Base_App $app */ foreach ( $apps as $app ) { echo '<div class="elementor-connect-app-wrapper">'; $app->render_admin_widget(); echo '</div>'; } ?> </div><!-- /.wrap --> <script> jQuery( function(){ jQuery( '.elementor-connect-button' ).elementorConnect(); } ); </script> <?php } public function __construct() { self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID ); add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 206 ); add_action( 'admin_head', [ $this, 'hide_menu_item' ] ); add_action( 'load-elementor_page_' . self::PAGE_ID, [ $this, 'on_load_page' ] ); } }