From 9e303488571b5989c4582d6452830eba45c29441 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Fri, 25 Oct 2024 11:31:11 +0100 Subject: [PATCH] Directly reference plugin array copy --- src/Model/PluginFamily.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Model/PluginFamily.php b/src/Model/PluginFamily.php index b3e616d..785f4d2 100644 --- a/src/Model/PluginFamily.php +++ b/src/Model/PluginFamily.php @@ -71,16 +71,18 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi $active_plugins[ $plugin ] = $plugins[ $cat ]['plugins'][ $plugin ]; // Remove active plugin from current category. - unset( $cat_data['plugins'][ $plugin ] ); + $active_plugin = $plugins[ $cat ]['plugins'][ $plugin ]; + unset( $plugins[ $cat ]['plugins'][ $plugin ] ); // Send active plugin to the end of array in current category. - $cat_data['plugins'][ $plugin ] = $plugins[ $cat ]['plugins'][ $plugin ]; + $plugins[ $cat ]['plugins'][ $plugin ] = $active_plugin; // Remove category with active plugin from current array. + $active_cat = $plugins[ $cat ]; unset( $plugins[ $cat ] ); // Send category with active plugins to the end of array. - $plugins[ $cat ] = $cat_data; + $plugins[ $cat ] = $active_cat; continue; }