CRM-16891 - Add hook_civicrm_coreResourceList
authorColeman Watts <coleman@civicrm.org>
Thu, 23 Jul 2015 00:19:58 +0000 (20:19 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 23 Jul 2015 00:19:58 +0000 (20:19 -0400)
CRM/Core/Resources.php
CRM/Utils/Hook.php

index 75ca3926f79e04252196a602b89132c7f0d416bf..3b682b17aa9c65627ebdbb1e31b951a3fd2dd8dd 100644 (file)
@@ -749,8 +749,8 @@ class CRM_Core_Resources {
       }
     }
 
-    // CMS-specific resources
-    $config->userSystem->appendCoreResources($items);
+    // Allow hooks to modify this list
+    CRM_Utils_Hook::coreResourceList($items);
 
     return $items;
   }
index 60c1c088f00c851781ee790770f3e646be05a8ad..eae92f03d9e645d593263df5aef601faae0c15c4 100644 (file)
@@ -1947,4 +1947,21 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called when core resources are being loaded
+   *
+   * @see CRM_Core_Resources::coreResourceList
+   *
+   * @param array $list
+   */
+  public static function coreResourceList(&$list) {
+    // First allow the cms integration to add to the list
+    CRM_Core_Config::singleton()->userSystem->appendCoreResources($list);
+
+    self::singleton()->invoke(1, $list,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_coreResourceList'
+    );
+  }
+
 }