Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Add/context module #952

Merged
merged 25 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cc2575b
add context module and required updates due to wp-forge/helper update
circlecube Feb 16, 2024
501fa3b
add context module
circlecube Feb 20, 2024
ccf8c4c
add some comments and cleanup
circlecube Feb 20, 2024
24f2b99
update to latest context module
circlecube Feb 21, 2024
628be30
remove supported cache types if atomic
circlecube Feb 21, 2024
889bce5
update context module to 1.0.0
circlecube Feb 22, 2024
b6df838
update marketplace brand from context provided platform
circlecube Feb 22, 2024
5e592d7
set context adjusted after context is set
circlecube Feb 22, 2024
1bd9ea3
set priority to 11 so it always happens after the default 10
circlecube Feb 22, 2024
2e30304
remove atomic id constant and atomic constant
circlecube Feb 23, 2024
5777d4a
lint fix-up
circlecube Feb 23, 2024
c8b74f6
lint fix-up
circlecube Feb 23, 2024
a79d0c4
Merge branch 'release/3.8.5' into add/context-module
circlecube Feb 23, 2024
f8e0eae
composer validate
circlecube Feb 23, 2024
5195ee9
Merge branch 'main' into add/context-module
circlecube Feb 24, 2024
bec4a4a
Merge branch 'release/3.8.5' into add/context-module
circlecube Feb 24, 2024
8645758
module updates
circlecube Feb 26, 2024
c71286c
Merge branch 'release/3.9.0' into add/context-module
circlecube Feb 26, 2024
326f2ee
validate composer
circlecube Feb 26, 2024
08c5de9
remove commented test code and required file that should work with na…
circlecube Feb 26, 2024
e8353ce
test without permalink command
circlecube Feb 26, 2024
b94014f
Merge branch 'release/3.9.0' into add/context-module
circlecube Feb 27, 2024
3f68422
make sure container exists to fix CLI command issue
circlecube Feb 27, 2024
b50d34f
update performance and staging modules for coordinated context updates
circlecube Feb 27, 2024
a1a0637
Merge branch 'release/3.9.0' into add/context-module
circlecube Feb 27, 2024
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
47 changes: 38 additions & 9 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
use WP_Forge\UpgradeHandler\UpgradeHandler;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\ModuleLoader\Plugin;
use NewfoldLabs\WP\Context\Context;
use function NewfoldLabs\WP\ModuleLoader\container as setContainer;
use function NewfoldLabs\WP\Context\setContext;
use function NewfoldLabs\WP\Context\getContext;

// Composer autoloader
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
Expand All @@ -25,12 +28,17 @@
}

/*
* Initialize coming soon module via container
* Initialize module settings via container
*/
$bluehost_module_container = new Container(
array(
'cache_types' => array( 'browser', 'skip404' ),
)
$bluehost_module_container = new Container();

// Context setup
add_action(
'newfold/context/set',
function () {
// set brand
setContext( 'brand.name', 'bluehost' );
}
);

// Set plugin to container
Expand All @@ -51,12 +59,32 @@ function () {
)
);

$bluehost_module_container->set(
'marketplace_brand',
'bluehost'
// Assign container values based on context
add_action(
'plugins_loaded',
function () {
global $bluehost_module_container;

// Performance default settings
$cache_types = array( 'browser', 'skip404' );
// Marketplace default settings
$marketplace_brand = 'bluehost';

// Platform overrides
if ( 'atomic' === getContext( 'platform' ) ) {
$cache_types = array();
$marketplace_brand = 'bluehost-cloud';
}

if ( $bluehost_module_container ) {
$bluehost_module_container->set( 'cache_types', $cache_types );
$bluehost_module_container->set( 'marketplace_brand', $marketplace_brand );
}
},
11
);

// properly get branding links depending on market
// Properly get branding links depending on market
$wordpress_hosting_page = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://www.bluehost.in?utm_source=coming-soon-template&utm_medium=bluehost_plugin' : 'https://bluehost.com?utm_source=coming-soon-template&utm_medium=bluehost_plugin';
$my_panel = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://my.bluehost.in/web-hosting/cplogin' : 'https://my.bluehost.com/web-hosting/cplogin';
$website_guide_link = 'https://www.bluehost.com/blog/how-to-create-a-website-guide/';
Expand Down Expand Up @@ -106,6 +134,7 @@ function () {
'template_styles' => esc_url( BLUEHOST_PLUGIN_URL . 'assets/styles/coming-soon.css' ),
)
);

setContainer( $bluehost_module_container );

// Set up the updater endpoint and map values
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"require": {
"newfold-labs/wp-module-business-reviews": "^1.1.1",
"newfold-labs/wp-module-coming-soon": "^1.2.0",
"newfold-labs/wp-module-context": "^1.0.0",
"newfold-labs/wp-module-ctb": "^1.1.3",
"newfold-labs/wp-module-customer-bluehost": "^1.6.0",
"newfold-labs/wp-module-data": "^2.4.18",
Expand All @@ -80,12 +81,12 @@
"newfold-labs/wp-module-notifications": "^1.2.5",
"newfold-labs/wp-module-onboarding": "^2.1.3",
"newfold-labs/wp-module-patterns": "^0.1.14",
"newfold-labs/wp-module-performance": "^1.3.1",
"newfold-labs/wp-module-performance": "^1.4.0",
"newfold-labs/wp-module-runtime": "^1.0.9",
"newfold-labs/wp-module-secure-passwords": "^1.1.1",
"newfold-labs/wp-module-sso": "^1.0.4",
"newfold-labs/wp-module-staging": "^1.2.3",
"wp-forge/wp-update-handler": "^1.0",
"newfold-labs/wp-module-staging": "^1.3.0",
"wp-forge/wp-update-handler": "^1.0.2",
"wp-forge/wp-upgrade-handler": "^1.0"
}
}
84 changes: 71 additions & 13 deletions composer.lock

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

49 changes: 43 additions & 6 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Bluehost;

use function NewfoldLabs\WP\Context\getContext;

/**
* \Bluehost\Admin
*/
Expand Down Expand Up @@ -56,14 +58,49 @@ public static function add_to_runtime( $sdk ) {
* @return array
*/
public static function subpages() {
return array(
'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ),
'bluehost#/store' => __( 'Store', 'wp-plugin-bluehost' ),
global $bluehost_module_container;

$home = array(
'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ),
);
$store = array(
'bluehost#/store' => __( 'Store', 'wp-plugin-bluehost' ),
);
$marketplace = array(
'bluehost#/marketplace' => __( 'Marketplace', 'wp-plugin-bluehost' ),
);
$performance = array(
'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ),
'bluehost#/settings' => __( 'Settings', 'wp-plugin-bluehost' ),
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
'bluehost#/help' => __( 'Help', 'wp-plugin-bluehost' ),
);
$settings = array(
'bluehost#/settings' => __( 'Settings', 'wp-plugin-bluehost' ),
);
$staging = array(
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
);
$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,
$marketplace,
$performance,
$settings,
$staging,
$help
);
}

Expand Down
20 changes: 11 additions & 9 deletions src/app/components/app-nav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ export const SideNavMenu = () => {
return (
<ul className="nfd-flex nfd-flex-col nfd-gap-1.5">
{ topRoutes.map( ( page ) => (
<SideNavMenuItem
key={ page.name }
label={ page.title }
name={ page.name }
icon={ page.Icon }
path={ page.name }
action={ page.action }
subItems={ page.subRoutes }
/>
true === page.condition && (
<SideNavMenuItem
key={ page.name }
label={ page.title }
name={ page.name }
icon={ page.Icon }
path={ page.name }
action={ page.action }
subItems={ page.subRoutes }
/>
)
) ) }
</ul>
);
Expand Down
Loading
Loading