function patterns_moduletags_get_index in Patterns 7
Same name and namespace in other branches
- 7.2 includes/tagmodules.inc \patterns_moduletags_get_index()
Builds up an associative array of modules and exposed tags.
The index is cached, but reloading can be forced.
Parameters
array $data (optional) An associative array of data, that the: components can use to build dynamic forms names. Defaults NULL. The array usually corresponds to an action in a pattern file, e.g.
array('tag' => 'node', 'type' => 'article', 'title' => 'Test Article', 'body', => 'lorem ipsum ...', );
bool $reset If TRUE, forces rebuilding the index from all: the components. Defaults FALSE
bool $reload_components (optional) If TRUE, forces reloading: the Patterns components from file system
Return value
array $moduletags The tagmodules index built according to the parameters.
See also
patterns_tagmodules_get_index()
5 calls to patterns_moduletags_get_index()
- drush_patterns_export in ./
patterns.drush.inc - Export data from the patterns components to file, zip archive, or database
- PatternsIndexesTestCase::testModuletags in tests/
indexes/ indexes.test - patterns_api_is_valid_component_name in includes/
api/ api.inc - Checks whether a string is an existing component name.
- patterns_export_list_export_functions in patterns_export/
patterns_export.module - Returns a list with the names of the components.
- patterns_export_submit in patterns_export/
patterns_export.module - Submit hook of the export form
File
- includes/
tagmodules.inc, line 218 - Functions related to build and retrieve information from the *tagmodules* and *moduletags* indexes.
Code
function patterns_moduletags_get_index($data = NULL, $reset = FALSE, $reload_components = FALSE) {
$moduletags =& drupal_static(__FUNCTION__);
if ($reload_components) {
patterns_io_load_components();
}
// Index not yet built
if ($reset || empty($moduletags)) {
$moduletags = array();
foreach (module_implements('patterns') as $component) {
_patterns_moduletags_add_module($component, $moduletags, $data);
//$tags = module_invoke($component, 'patterns', $data);
//$moduletags[$component] = $tags;
}
}
elseif (!empty($data)) {
$module = patterns_tagmodules_find_module($data);
_patterns_moduletags_add_module($moduletags, $module, $data);
}
// All values from all tags
return $moduletags;
}