Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ public static function is_elementor_installed(): bool {
return $elementor_installed;
}

public static function get_theme_builder_slug(): string {
if ( ! class_exists( 'Elementor\App\App' ) ) {
return '';
}

if ( self::has_pro() ) {
return App::PAGE_ID . '&ver=' . ELEMENTOR_VERSION . '#site-editor';
}

if ( self::is_elementor_active() ) {
return App::PAGE_ID . '&ver=' . ELEMENTOR_VERSION . '#site-editor/promotion';
}

return '';
}

public static function get_theme_builder_url(): string {
if ( ! class_exists( 'Elementor\App\App' ) ) {
return 'https://go.elementor.com/hello-theme-builder';
Expand All @@ -79,10 +63,6 @@ public static function get_elementor_activation_link(): string {
return add_query_arg( '_wpnonce', wp_create_nonce( 'activate-plugin_' . $plugin ), $url );
}

public static function get_ai_site_planner_url(): string {
return 'https://go.elementor.com/hello-site-planner';
}

public static function get_plugin_install_url( $plugin_slug ): string {
$action = 'install-plugin';

Expand Down
8 changes: 0 additions & 8 deletions modules/admin-home/assets/js/hello-elementor-menu.js

This file was deleted.

51 changes: 0 additions & 51 deletions modules/admin-home/components/admin-menu-controller.php
Comment thread
nirbhayel marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@
exit; // Exit if accessed directly.
}

use HelloTheme\Includes\Script;
use HelloTheme\Includes\Utils;

class Admin_Menu_Controller {

const MENU_PAGE_ICON = 'dashicons-plus-alt';
const MENU_PAGE_POSITION = 59.9;
const AI_SITE_PLANNER_SLUG = '-ai-site-planner';
const THEME_BUILDER_SLUG = '-theme-builder';
Comment thread
nirbhayel marked this conversation as resolved.

public function admin_menu(): void {
add_menu_page(
Expand All @@ -37,59 +32,13 @@ public function admin_menu(): void {
);

do_action( 'hello-plus-theme/admin-menu', EHP_THEME_SLUG );

$theme_builder_slug = Utils::get_theme_builder_slug();
add_submenu_page(
EHP_THEME_SLUG,
__( 'Theme Builder', 'hello-elementor' ),
__( 'Theme Builder', 'hello-elementor' ),
'manage_options',
empty( $theme_builder_slug ) ? EHP_THEME_SLUG . self::THEME_BUILDER_SLUG : $theme_builder_slug,
[ $this, 'render_home' ]
);

add_submenu_page(
EHP_THEME_SLUG,
__( 'AI Site Planner', 'hello-elementor' ),
__( 'AI Site Planner', 'hello-elementor' ),
'manage_options',
EHP_THEME_SLUG . self::AI_SITE_PLANNER_SLUG,
[ $this, 'render_home' ]
);
}

public function render_home(): void {
echo '<div id="ehe-admin-home"></div>';
}

public function redirect_menus(): void {
$page = sanitize_key( filter_input( INPUT_GET, 'page', FILTER_UNSAFE_RAW ) );

switch ( $page ) {
case EHP_THEME_SLUG . self::AI_SITE_PLANNER_SLUG:
wp_redirect( Utils::get_ai_site_planner_url() );
exit;

case EHP_THEME_SLUG . self::THEME_BUILDER_SLUG:
wp_redirect( Utils::get_theme_builder_url() );
exit;

default:
break;
}
}

public function admin_enqueue_scripts() {
$script = new Script(
'hello-elementor-menu',
);

$script->enqueue();
}

public function __construct() {
add_action( 'admin_menu', [ $this, 'admin_menu' ] );
add_action( 'admin_init', [ $this, 'redirect_menus' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
}
}
5 changes: 0 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ const entryPoints = {
'admin-home/assets/js',
'hello-elementor-admin.js',
),
'js/hello-elementor-menu': path.resolve(
modulesDir,
'admin-home/assets/js',
'hello-elementor-menu.js',
),
'js/hello-elementor-settings': path.resolve(
modulesDir,
'admin-home/assets/js',
Expand Down
Loading