You are here

function patterns_tagmodules_find_module in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/tagmodules.inc \patterns_tagmodules_find_module()

Tries to find the module responsible for a given action.

Parameters

array $action Array representing a Patterns action.:

Return value

mixed|bool The name of the module responsible for the action or FALSE, it fails to match the action with a module.

2 calls to patterns_tagmodules_find_module()
patterns_moduletags_get_index in includes/tagmodules.inc
Builds up an associative array of modules and exposed tags.
patterns_tagmodules_get_index in includes/tagmodules.inc
Builds an associative array of tags and modules (components).

File

includes/tagmodules.inc, line 275
Functions related to build and retrieve information from the *tagmodules* and *moduletags* indexes.

Code

function patterns_tagmodules_find_module($action, $tagmodules = NULL) {
  if (isset($action['module']) && !empty($action['module'])) {
    return $action['module'];
  }
  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'];
    }
  }
  return FALSE;
}