Index: strongarm.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/strongarm/strongarm.module,v retrieving revision 1.1.2.6 diff -u -p -r1.1.2.6 strongarm.module --- strongarm.module 24 Sep 2009 16:17:23 -0000 1.1.2.6 +++ strongarm.module 1 Oct 2009 22:57:36 -0000 @@ -44,24 +44,23 @@ function strongarm_get_conf($bootstrappe $var_conf = $cache ? $cache->data : NULL; } if (!isset($var_conf) && $bootstrapped) { - // We don't use module_invoke_all() here since - // array_merge_recursive() can alter the desired structure of - // some variables. + global $conf; + // Get the weakarm vars first. We don't use module_invoke_all() + // here since array_merge_recursive() can alter the desired + // structure of some variables. + foreach (module_implements('weakarm') as $module) { + $module_conf = module_invoke($module, 'weakarm'); + foreach ($module_conf as $name => $value) { + if (!isset($conf[$name])) { + _strongarm_conf_merge($var_conf, $name, $value); + } + } + } + // Now get the strongarm vars. foreach (module_implements('strongarm') as $module) { $module_conf = module_invoke($module, 'strongarm'); foreach ($module_conf as $name => $value) { - if (isset($var_conf[$name])) { - if (is_array($value)) { - $var_conf[$name] = array_merge($var_conf[$name], $value); - } - else { - // Blow the earlier one away - $var_conf[$name] = $value; - } - } - else { - $var_conf[$name] = $value; - } + _strongarm_conf_merge($var_conf, $name, $value); } } cache_set('strongarm', $var_conf); @@ -168,3 +167,28 @@ function strongarm_flush_caches() { cache_clear_all('variables', 'cache'); cache_clear_all('strongarm', 'cache'); } + +/** + * Helper function to merge a variable into a working conf array. + * + * @param $var_conf + * The working conf array, passed by reference. + * @param $name + * String, the key of the variable. + * @param $value + * Mixed, the value of the variable. + */ +function _strongarm_conf_merge(&$var_conf, $name, $value) { + if (isset($var_conf[$name])) { + if (is_array($value)) { + $var_conf[$name] = array_merge($var_conf[$name], $value); + } + else { + // Blow the earlier one away + $var_conf[$name] = $value; + } + } + else { + $var_conf[$name] = $value; + } +}