function patterns_invoke in Patterns 6
Same name and namespace in other branches
- 5 patterns.module \patterns_invoke()
- 6.2 patterns.module \patterns_invoke()
- 7.2 patterns.module \patterns_invoke()
- 7 patterns.module \patterns_invoke()
2 calls to patterns_invoke()
- patterns_implement_action in ./
patterns.module - Setup and run an action
- patterns_prepare_actions in ./
patterns.module
File
- ./
patterns.module, line 1938 - Enables extremely simple adding/removing features to your site with minimal to no configuration
Code
function patterns_invoke(&$data, $op, $form_id = null, &$a = null) {
static $tag_modules;
if (!is_array($tag_modules) || $op == 'tag modules') {
// Get a list of tags and their modules
foreach (module_implements('patterns') as $module) {
$tags = module_invoke($module, 'patterns', 'tags');
foreach ($tags as $tag => $value) {
if (is_array($value)) {
$tag_modules[$tag] = $module;
}
else {
$tag_modules[$value] = $module;
}
}
}
}
// If you just want the modules list
if ($op == 'tag modules') {
return $tag_modules;
}
$tag = $data['tag'];
unset($data['tag']);
$module = $tag_modules[$tag];
$func = $module . '_patterns';
if (function_exists($func)) {
if ($form_id) {
$return = $func($op, $form_id, $data, $a);
}
else {
$return = $func($op, $tag, $data, $a);
}
}
$data['tag'] = $tag;
return $return;
}