Skip to content

Commit

Permalink
Merge pull request #527 from newfold-labs/feature/install-plugins-ext…
Browse files Browse the repository at this point in the history
…ended

Fix `Priorities`
  • Loading branch information
arunshenoy99 authored Mar 20, 2024
2 parents 26b83fe + d5655b6 commit 442d210
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions includes/Services/PluginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ public static function initialize() {

$flow = Data::current_flow();
if ( 'sitegen' === $flow && SiteGenService::is_enabled() ) {
$init_plugins = SiteGenService::get_plugin_recommendations();
if ( is_wp_error( $init_plugins ) ) {
return $init_plugins;
}
$init_plugins = Plugins::get_init();

// Convert { slug->slug } to hash for faster search
// As Php uses array as { [0] -> slug_name } and that won't work with array_key_exists
$plugin_slugs = array_column( $init_plugins, 'slug', 'slug' );

// Iterate and ensure no duplicates are added
$default_plugins = Plugins::get_init();
$default_plugins = SiteGenService::get_plugin_recommendations();
if ( is_wp_error( $default_plugins ) ) {
return $default_plugins;
}
foreach ( $default_plugins as $default_plugin ) {
if ( ! array_key_exists( $default_plugin['slug'], $plugin_slugs ) ) {
$init_plugins[] = $default_plugin;
Expand Down

0 comments on commit 442d210

Please sign in to comment.