Skip to content

Commit

Permalink
features module development and integration
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed May 3, 2024
1 parent 09fc743 commit ade0916
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ function () {
new Admin();
}



require_once BLUEHOST_PLUGIN_DIR . '/vendor/newfold-labs/wp-module-features/bootstrap.php';
// 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';
11 changes: 6 additions & 5 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Bluehost;

use function NewfoldLabs\WP\Context\getContext;
use function NewfoldLabs\WP\Module\Features\isEnabled;

/**
* \Bluehost\Admin
Expand Down Expand Up @@ -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' ),
Expand All @@ -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' ),
);

Expand Down
8 changes: 5 additions & 3 deletions inc/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down

0 comments on commit ade0916

Please sign in to comment.