From 0d81e156e5dc6c3b1ec1229a276eb196350a2b42 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Thu, 27 Jul 2023 16:41:29 +0100 Subject: [PATCH] standalone: improve code efficiency --- CRM/Utils/System/Standalone.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/CRM/Utils/System/Standalone.php b/CRM/Utils/System/Standalone.php index 584e9d7bc7..0148b32c67 100644 --- a/CRM/Utils/System/Standalone.php +++ b/CRM/Utils/System/Standalone.php @@ -109,21 +109,9 @@ class CRM_Utils_System_Standalone extends CRM_Utils_System_Base { */ public function appendBreadCrumb($breadcrumbs) { $crumbs = \Civi::$statics[__CLASS__]['breadcrumb'] ?? []; - - foreach ($breadcrumbs as $crumb) { - $duplicate = FALSE; - foreach ($crumbs as $existingCrumb) { - if ($existingCrumb['url'] === $crumb['url']) { - $duplicate = TRUE; - break; - } - } - if (!$duplicate) { - $crumbs[] = $crumb; - } - } + $crumbs += array_column($breadcrumbs, null, 'url'); \Civi::$statics[__CLASS__]['breadcrumb'] = $crumbs; - CRM_Core_Smarty::singleton()->assign('breadcrumb', $crumbs); + CRM_Core_Smarty::singleton()->assign('breadcrumb', array_values($crumbs)); } /** -- 2.25.1