From 0bf720b66bf36c25a199e5e7089679851d3d945c Mon Sep 17 00:00:00 2001 From: Sebastian Zoglowek <55794780+zoglo@users.noreply.github.com> Date: Wed, 11 Oct 2023 01:45:50 +0200 Subject: [PATCH] Fixed wrong class override with bundle config - if an option was not found, the first value has been overwritten due to array_search returning false, hence searching for the first key '0' within the classes array --- src/StyleManager/Sync.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/StyleManager/Sync.php b/src/StyleManager/Sync.php index 22fe2d5..dd3318e 100644 --- a/src/StyleManager/Sync.php +++ b/src/StyleManager/Sync.php @@ -205,12 +205,13 @@ public static function mergeGroupObjects(?StyleManagerModel $objOriginal, ?Style } // Overwrite existing value - $key = array_search($field, array_column($arrClasses, 'key')); - - $arrClasses[ $key ] = [ - 'key' => $cssClass['key'], - 'value' => $cssClass['value'] - ]; + if (!$key = array_search($field, array_column($arrClasses, 'key'))) + { + $arrClasses[ $key ] = [ + 'key' => $cssClass['key'], + 'value' => $cssClass['value'] + ]; + } continue; }