REF - Cleanup array key checking to use array_key_exists
[civicrm-core.git] / CRM / Contact / Page / DashBoard.php
index 55d48127df4e22893194136b4234d7522fa70fc1..48ea3ac19cecaad86b62c767605d7fe3dc895d3d 100644 (file)
@@ -44,24 +44,21 @@ class CRM_Contact_Page_DashBoard extends CRM_Core_Page {
       }
     }
 
-    $loader = new Civi\Angular\AngularLoader();
+    $loader = Civi::service('angularjs.loader');
+    $loader->addModules('crmDashboard');
     $loader->setPageName('civicrm/dashboard');
 
     // For each dashlet that requires an angular directive, load the angular module which provides that directive
-    $modules = [];
     foreach (CRM_Core_BAO_Dashboard::getContactDashlets() as $dashlet) {
       if (!empty($dashlet['directive'])) {
         foreach ($loader->getAngular()->getModules() as $name => $module) {
           if (!empty($module['exports'][$dashlet['directive']])) {
-            $modules[] = $name;
+            $loader->addModules($name);
             continue;
           }
         }
       }
     }
-    $loader->setModules($modules);
-
-    $loader->load();
 
     return parent::run();
   }