From 87edc8d2ab0de60dcd21d893583d6e0aabf8eeb7 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 17 Sep 2020 17:26:38 -0700 Subject: [PATCH] CRM_Core_Resources::addBundle() - Fix handling of array inputs (This fixes a small bug in a new function added during this release -- part of #18247.) The signature of `addBundle()` optionally accepts an array/iterable -- if given, then it should add all the items from the array. For example: ```php Civi::resources()->addBundle(['foo', 'bar']); ``` Before ------ It adds `foo` but then bails out on `bar`. After ----- It adds both `foo` and `bar`. --- CRM/Core/Resources.php | 2 +- CRM/Core/Resources/CollectionTrait.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 4a48798230..77467b6120 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -206,8 +206,8 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface if (is_iterable($bundle)) { foreach ($bundle as $b) { $this->addBundle($b); - return $this; } + return $this; } if (is_string($bundle)) { diff --git a/CRM/Core/Resources/CollectionTrait.php b/CRM/Core/Resources/CollectionTrait.php index b7616edafc..ec7ef18453 100644 --- a/CRM/Core/Resources/CollectionTrait.php +++ b/CRM/Core/Resources/CollectionTrait.php @@ -327,8 +327,8 @@ trait CRM_Core_Resources_CollectionTrait { if (is_iterable($bundle)) { foreach ($bundle as $b) { $this->addBundle($b); - return $this; } + return $this; } if (is_string($bundle)) { $bundle = Civi::service('bundle.' . $bundle); -- 2.25.1