CRM-12370 - add extension modules immediately after civicrm drupal module.
authorKeith Morgan <keith@wellebee.com>
Thu, 24 Jul 2014 21:33:53 +0000 (16:33 -0500)
committerKeith Morgan <keith@wellebee.com>
Thu, 24 Jul 2014 21:33:53 +0000 (16:33 -0500)
----------------------------------------
* CRM-12370: CRM_Utils_Hook::requireCiviModules() assigns infinite weight to extensions
  https://issues.civicrm.org/jira/browse/CRM-12370

CRM/Utils/Hook/DrupalBase.php

index 1561ff3dee839b70a962dc278ec1e751ee080294..4103689263e1a41691e909d802ebeab843e3ba26 100644 (file)
@@ -97,7 +97,25 @@ 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;