Skip to content

Commit

Permalink
[J#BWP-39][CONFIG] Initialise flagpole earlier.
Browse files Browse the repository at this point in the history
Initialised flagpole before plugins are loaded. The reason for this is so
that flagpole can be used before all plugins are loaded as some plugins
may need a feature flag at the init stage.
  • Loading branch information
martisim committed Dec 12, 2022
1 parent c039059 commit 5cfab3a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions wp-content/mu-plugins/000-boxuk-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,26 @@ static function() {
}
);

/**
* Register feature flags if we have a flags.yaml set.
*/
$plugin_active = boxuk_container()->has( 'BoxUk\Plugins\Base\FeatureFlag\FeatureFlagManager' );
if ( $plugin_active === true && file_exists( __DIR__ . '/000-boxuk/flags.yaml' ) ) {
/**
* IDE hint.
*
* @var FeatureFlagManager $feature_flag_manager
*/
$feature_flag_manager = boxuk_container()->get( 'BoxUk\Plugins\Base\FeatureFlag\FeatureFlagManager' );
$feature_flag_manager->register_from_yaml_file( __DIR__ . '/000-boxuk/flags.yaml' );
}

/**
* Things to do by default once all plugins have been loaded.
*/
add_action(
'plugins_loaded',
static function() {
// Register feature flags if we have a flags.yaml set.
$plugin_active = boxuk_container()->has( 'BoxUk\Plugins\Base\FeatureFlag\FeatureFlagManager' );
if ( $plugin_active === true && file_exists( __DIR__ . '/000-boxuk/flags.yaml' ) ) {
/**
* IDE hint.
*
* @var FeatureFlagManager $feature_flag_manager
*/
$feature_flag_manager = boxuk_container()->get( 'BoxUk\Plugins\Base\FeatureFlag\FeatureFlagManager' );
$feature_flag_manager->register_from_yaml_file( __DIR__ . '/000-boxuk/flags.yaml' );
}

$locale = get_locale();
load_textdomain( PROJECT_NAME, WP_LANG_DIR . '/' . PROJECT_NAME . '-' . $locale . '.mo' );
}
Expand Down

0 comments on commit 5cfab3a

Please sign in to comment.