You are here

function _patterns_tagmodules_add_module in Patterns 7.2

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

Helper function for <patterns_tagmodules_get_index>.

Call <hook_patterns> on a given module and merge the results in the tagmodules index.

Parameters

mixed $module A string representing a module (component) name:

array $tagmodules An array containing the tagmodules index:

array $data (optional) An associative array of data, that the: components can use to build dynamic forms names. Defaults NULL.

See also

patterns_tagmodules_get_index()

_patterns_tagmodules_add_module()

1 call to _patterns_tagmodules_add_module()
patterns_tagmodules_get_index in includes/tagmodules.inc
Builds an associative array of tags and modules (components).

File

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

Code

function _patterns_tagmodules_add_module($module, &$tagmodules, $data = NULL) {
  if (empty($tagmodules)) {
    $tagmodules = array();
  }
  if (empty($module)) {
    return;
  }
  $tags = module_invoke($module, 'patterns', $data);
  if (empty($tags)) {

    // should not be the case. It is a component error
    return FALSE;
  }
  _patterns_tagmodules_add_module_to_tags($module, $tags);
  $tagmodules = array_merge($tagmodules, $tags);
}