Skip to content
Browse files

Fixed bugs in tagmodules

  • Loading branch information...
1 parent f5b863d commit 09ffdf55ce56a7f48b56c2a0c45c6cb9fa679d7b @shakty committed Apr 22, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 includes/tagmodules.inc
View
11 includes/tagmodules.inc
@@ -46,7 +46,7 @@ function patterns_tagmodules_get_index($data = NULL, $reset = FALSE) {
}
// We may need to rebuild the index just for the specific tag
else if (!empty($data)) {
- $module = patterns_tagmodules_find_module($data);
+ $module = patterns_tagmodules_find_module($data, $tagmodules);
_patterns_tagmodules_add_module($module, $tagmodules, $data);
}
@@ -239,14 +239,15 @@ function _patterns_moduletags_add_module($module, &$moduletags, $data = NULL) {
* @return mixed|bool The name of the module responsible for the
* action or FALSE, it fails to match the action with a module.
*/
-function patterns_tagmodules_find_module($action) {
+function patterns_tagmodules_find_module($action, $tagmodules = NULL) {
if (isset($action['module']) && !empty($action['module'])) {
return $action['module'];
}
- if (isset($data['tag'])) {
- $tagmodules = patterns_tagmodules_get_index($action);
- $tag_name = $data['tag'];
+ if (isset($action['tag'])) {
+ $tagmodules = (is_null($tagmodules)) ? patterns_tagmodules_get_index($action)
+ : $tagmodules;
+ $tag_name = $action['tag'];
if (isset($tagmodules[$tag_name]['module'])) {
return $tagmodules[$tag_name]['module'];
};

0 comments on commit 09ffdf5

Please sign in to comment.
Something went wrong with that request. Please try again.