diff --git a/inc/Admin.php b/inc/Admin.php index 2659a5b30..d95cdb58e 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -9,6 +9,7 @@ use function NewfoldLabs\WP\Context\getContext; use function NewfoldLabs\WP\Module\Features\isEnabled; +use NewfoldLabs\WP\Module\Data\SiteCapabilities; /** * \Bluehost\Admin @@ -66,6 +67,10 @@ public static function add_to_runtime( $sdk ) { public static function subpages() { global $bluehost_module_container; + $capability = new SiteCapabilities(); + + $hasSolution = $capability->get( 'hasSolution' ); + $home = array( 'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ), ); @@ -78,6 +83,9 @@ public static function subpages() { $marketplace = array( 'bluehost#/marketplace' => __( 'Marketplace', 'wp-plugin-bluehost' ), ); + $mypluginsandtools = array( + 'bluehost#/my_plugins_and_tools' => __( 'My Plugins & Tools', 'wp-plugin-bluehost' ), + ); // add performance if enabled $performance = isEnabled( 'performance' ) ? array( @@ -97,16 +105,31 @@ public static function subpages() { 'bluehost#/help' => __( 'Help', 'wp-plugin-bluehost' ), ); - return array_merge( - $home, - $pagesAndPosts, - $store, - $marketplace, - $performance, - $settings, - $staging, - $help - ); + if($hasSolution){ + return array_merge( + $home, + $pagesAndPosts, + $store, + $marketplace, + $mypluginsandtools, + $performance, + $settings, + $staging, + $help + ); + } + else{ + return array_merge( + $home, + $pagesAndPosts, + $store, + $marketplace, + $performance, + $settings, + $staging, + $help + ); + } } /** diff --git a/src/app/data/routes.js b/src/app/data/routes.js index 6500e42e5..392280d14 100644 --- a/src/app/data/routes.js +++ b/src/app/data/routes.js @@ -71,7 +71,7 @@ const topRoutePaths = [ '/pages-and-posts', '/store', '/marketplace', - '/my_plugins_and_tools', + '/my_plugins_and_tools', '/performance', '/settings', '/staging', @@ -138,13 +138,13 @@ export const routes = [ subRoutes: await getMarketplaceSubnavRoutes(), condition: true, }, - { + NewfoldRuntime.hasCapability( 'hasSolution' ) && { name: '/my_plugins_and_tools', title: __( 'My Plugins & Tools', 'wp-plugin-bluehost' ), Component: Solutions, Icon: PuzzlePieceIcon, condition: true, - }, + }, { name: '/performance', title: __( 'Performance', 'wp-plugin-bluehost' ), diff --git a/src/app/pages/solutions/index.js b/src/app/pages/solutions/index.js index 58600dab4..778befa18 100644 --- a/src/app/pages/solutions/index.js +++ b/src/app/pages/solutions/index.js @@ -2,12 +2,11 @@ import './style.scss'; import apiFetch from '@wordpress/api-fetch'; import { useState, useEffect } from '@wordpress/element'; import { useLocation, useMatch, useNavigate } from 'react-router-dom'; -import { Container, Page, Title } from '@newfold/ui-component-library'; +import { Container, Page } from '@newfold/ui-component-library'; import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime'; import { default as NewfoldEntitlements } from '@modules/wp-module-solutions/components/entitlements'; const Solutions = () => { - // constants to pass to module const moduleConstants = { text: { @@ -38,13 +37,11 @@ const Solutions = () => { useNavigate, NewfoldRuntime, }; - + return (