From ade09160c77e47d0d8f2e2aeb086da0435593c31 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Fri, 3 May 2024 12:36:23 -0400 Subject: [PATCH] features module development and integration --- bootstrap.php | 6 +++--- inc/Admin.php | 11 ++++++----- inc/Data.php | 8 +++++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index 8429ff7fd..f08608e2c 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -200,6 +200,6 @@ function () { new Admin(); } - - -require_once BLUEHOST_PLUGIN_DIR . '/vendor/newfold-labs/wp-module-features/bootstrap.php'; \ No newline at end of file +// These shouldn't be needed once the autoloader is properly running in tagged releases +require_once BLUEHOST_PLUGIN_DIR . '/vendor/newfold-labs/wp-module-staging/includes/StagingFeature.php'; +require_once BLUEHOST_PLUGIN_DIR . '/vendor/newfold-labs/wp-module-features/includes/functions.php'; diff --git a/inc/Admin.php b/inc/Admin.php index c7a03c8bf..22c504b7c 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -8,6 +8,7 @@ namespace Bluehost; use function NewfoldLabs\WP\Context\getContext; +use function NewfoldLabs\WP\Module\Features\isEnabled; /** * \Bluehost\Admin @@ -61,7 +62,7 @@ public static function add_to_runtime( $sdk ) { * @return array */ public static function subpages() { - global $bluehost_module_container, $newfold_features; + global $bluehost_module_container; $home = array( 'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ), @@ -78,16 +79,16 @@ public static function subpages() { 'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ), ) : array(); - $settings = array( + $settings = array( 'bluehost#/settings' => __( 'Settings', 'wp-plugin-bluehost' ), ); // only add staging link if feature is enabled - $staging = $newfold_features->get('staging') - ? array( + $staging = isEnabled( 'staging' ) + ? array( 'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ), ) : array(); - $help = array( + $help = array( 'bluehost#/help' => __( 'Help', 'wp-plugin-bluehost' ), ); diff --git a/inc/Data.php b/inc/Data.php index 3458daf09..893e08455 100644 --- a/inc/Data.php +++ b/inc/Data.php @@ -7,6 +7,8 @@ namespace Bluehost; +use function NewfoldLabs\WP\Module\Features\getFeatures; + /** * \Bluehost\Data * This class does not have a constructor to get instantiated, just static methods. @@ -19,16 +21,16 @@ final class Data { * @return array */ public static function runtime() { - global $bluehost_module_container, $newfold_features; + global $bluehost_module_container; $runtime = array( - 'plugin' => array( + 'plugin' => array( 'url' => BLUEHOST_BUILD_URL, 'version' => BLUEHOST_PLUGIN_VERSION, 'assets' => BLUEHOST_PLUGIN_URL . 'assets/', 'brand' => $bluehost_module_container->plugin()->brand, ), - 'features' => $newfold_features->all(), + 'features' => getFeatures(), // just for now until we expose via js api endpoint ); return $runtime;