From 1a0580912670404d2789e83cba8be39f69bf3f3d Mon Sep 17 00:00:00 2001 From: Keith Morgan Date: Thu, 24 Jul 2014 16:33:53 -0500 Subject: [PATCH] CRM-12370 - add extension modules immediately after civicrm drupal module. ---------------------------------------- * CRM-12370: CRM_Utils_Hook::requireCiviModules() assigns infinite weight to extensions https://issues.civicrm.org/jira/browse/CRM-12370 --- CRM/Utils/Hook/DrupalBase.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Hook/DrupalBase.php b/CRM/Utils/Hook/DrupalBase.php index 1561ff3dee..4103689263 100644 --- a/CRM/Utils/Hook/DrupalBase.php +++ b/CRM/Utils/Hook/DrupalBase.php @@ -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; -- 2.25.1