Skip to content

Commit

Permalink
add features module and updated staging module
Browse files Browse the repository at this point in the history
add features to runtime and adjust menus accordingly
  • Loading branch information
circlecube committed Apr 26, 2024
1 parent a55bce0 commit 09fc743
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 30 deletions.
4 changes: 4 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,7 @@ function () {
if ( is_admin() ) {
new Admin();
}



require_once BLUEHOST_PLUGIN_DIR . '/vendor/newfold-labs/wp-module-features/bootstrap.php';
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"newfold-labs/wp-module-data": "^2.4.24",
"newfold-labs/wp-module-deactivation": "^1.1.1",
"newfold-labs/wp-module-ecommerce": "^1.3.27",
"newfold-labs/wp-module-features": "dev-main",
"newfold-labs/wp-module-global-ctb": "^1.0.11",
"newfold-labs/wp-module-help-center": "^1.0.24",
"newfold-labs/wp-module-loader": "^1.0.10",
Expand All @@ -83,7 +84,7 @@
"newfold-labs/wp-module-runtime": "^1.0.10",
"newfold-labs/wp-module-secure-passwords": "^1.1.1",
"newfold-labs/wp-module-sso": "^1.0.5",
"newfold-labs/wp-module-staging": "^1.3.3",
"newfold-labs/wp-module-staging": "dev-develop",
"wp-forge/wp-update-handler": "^1.0.2",
"wp-forge/wp-upgrade-handler": "^1.0"
}
Expand Down
71 changes: 63 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 14 additions & 19 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function add_to_runtime( $sdk ) {
* @return array
*/
public static function subpages() {
global $bluehost_module_container;
global $bluehost_module_container, $newfold_features;

$home = array(
'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ),
Expand All @@ -72,30 +72,25 @@ public static function subpages() {
$marketplace = array(
'bluehost#/marketplace' => __( 'Marketplace', 'wp-plugin-bluehost' ),
);
$performance = array(
'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ),
);
$settings = array(
// wp-cloud adjustment
$performance = ( 'atomic' === getContext( 'platform' ) )
? array(
'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ),
)
: array();
$settings = array(
'bluehost#/settings' => __( 'Settings', 'wp-plugin-bluehost' ),
);
$staging = array(
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
);
// only add staging link if feature is enabled
$staging = $newfold_features->get('staging')
? array(
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
)
: array();
$help = array(
'bluehost#/help' => __( 'Help', 'wp-plugin-bluehost' ),
);

// wp-cloud adjustments
if ( 'atomic' === getContext( 'platform' ) ) {
return array_merge(
$home,
$store,
$marketplace,
$settings,
$help
);
}

return array_merge(
$home,
$store,
Expand Down
3 changes: 2 additions & 1 deletion inc/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class Data {
* @return array
*/
public static function runtime() {
global $bluehost_module_container;
global $bluehost_module_container, $newfold_features;

$runtime = array(
'plugin' => array(
Expand All @@ -28,6 +28,7 @@ public static function runtime() {
'assets' => BLUEHOST_PLUGIN_URL . 'assets/',
'brand' => $bluehost_module_container->plugin()->brand,
),
'features' => $newfold_features->all(),
);

return $runtime;
Expand Down
2 changes: 1 addition & 1 deletion src/app/data/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const routes = [
title: __( 'Staging', 'wp-plugin-bluehost' ),
Component: Staging,
Icon: WrenchScrewdriverIcon,
condition: 'atomic' !== window.NewfoldRuntime.context.platform,
condition: window.NewfoldRuntime.features.staging,
},
{
name: '/help',
Expand Down

0 comments on commit 09fc743

Please sign in to comment.