a couple of comment block fixes
[civicrm-core.git] / CRM / Utils / Hook / DrupalBase.php
index 47f793311d20ab4e23643be37db3aed14606c4c1..9be37b1602ff63e4a1933a607a7f285e25e48968 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -55,17 +55,18 @@ class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook {
   private $drupalModules = NULL;
 
   /**
+   * @see CRM_Utils_Hook::invoke()
    *
-   *@see CRM_Utils_Hook::invoke()
-   *@param integer $numParams Number of parameters to pass to the hook
-   *@param unknown $arg1 parameter to be passed to the hook
-   *@param unknown $arg2 parameter to be passed to the hook
-   *@param unknown $arg3 parameter to be passed to the hook
-   *@param unknown $arg4 parameter to be passed to the hook
-   *@param unknown $arg5 parameter to be passed to the hook
-   *@param string $fnSuffix function suffix, this is effectively the hook name
-   *@return Ambigous <boolean, multitype:>
+   * @param integer $numParams Number of parameters to pass to the hook
+   * @param unknown $arg1 parameter to be passed to the hook
+   * @param unknown $arg2 parameter to be passed to the hook
+   * @param unknown $arg3 parameter to be passed to the hook
+   * @param unknown $arg4 parameter to be passed to the hook
+   * @param unknown $arg5 parameter to be passed to the hook
+   * @param mixed $arg6
+   * @param string $fnSuffix function suffix, this is effectively the hook name
    *
+   * @return Ambigous <boolean, multitype:>
    */
   function invoke($numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
@@ -81,7 +82,7 @@ class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook {
   /**
    * Build the list of modules to be processed for hooks.
    */
-  function buildModuleList() {
+  public function buildModuleList() {
     if ($this->isBuilt === FALSE) {
       if ($this->drupalModules === NULL) {
         if (function_exists('module_list')) {
@@ -95,11 +96,29 @@ class CRM_Utils_Hook_DrupalBase extends CRM_Utils_Hook {
         $this->requireCiviModules($this->civiModules);
       }
 
-      $this->allModules = array_merge((array)$this->drupalModules, (array)$this->civiModules);
+      // CRM-12370
+      // we should add civicrm's module's just after main civicrm drupal module
+      // Note: Assume that drupalModules and civiModules may each be array() or NULL
+      if ($this->drupalModules !== NULL) {
+        foreach ($this->drupalModules as $moduleName) {
+          $this->allModules[$moduleName] = $moduleName;
+          if ($moduleName == 'civicrm') {
+            if (!empty($this->civiModules)) {
+              foreach ($this->civiModules as $civiModuleName) {
+                $this->allModules[$civiModuleName] = $civiModuleName;
+              }
+            }
+          }
+        }
+      }
+      else {
+        $this->allModules = (array) $this->civiModules;
+      }
+
       if ($this->drupalModules !== NULL && $this->civiModules !== NULL) {
         // both CRM and CMS have bootstrapped, so this is the final list
         $this->isBuilt = TRUE;
       }
     }
   }
-}
\ No newline at end of file
+}