diff --git a/civicrm/CRM/Core/BAO/Dashboard.php b/civicrm/CRM/Core/BAO/Dashboard.php
index be9db756fc2373e1496bca15d1a605348e86ead4..99dff8f057b968a51a970b74faae5d9ca03c7630 100644
--- a/civicrm/CRM/Core/BAO/Dashboard.php
+++ b/civicrm/CRM/Core/BAO/Dashboard.php
@@ -367,9 +367,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
     // Get the array of IDs.
     $domainDashletIDs = [];
     if ($domainDashlets['is_error'] == 0) {
-      foreach ($domainDashlets['values'] as $domainDashlet) {
-        $domainDashletIDs[] = $domainDashlet['id'];
-      }
+      $domainDashletIDs = CRM_Utils_Array::collect('id', $domainDashlets['values']);
     }
 
     // Restrict query to Dashlets in this domain.