function patterns_parser_extract_all_actions in Patterns 7.2
Same name and namespace in other branches
- 7 includes/parser/parser.inc \patterns_parser_extract_all_actions()
Extract all the actions from a pattern and returns them as an array.
Parameters
mixed $pattern A pattern object, an array representing: the pattern object, a numeric id or alphanumeric name of the pattern as it is in the database
array $sections array containing the name of the sections,: from which extract the actions. If NULL, all the sections will be scanned.
3 calls to patterns_parser_extract_all_actions()
- patterns_parser_include_pattern in includes/
parser/ parser.inc - Inserts the actions of a pattern into another one. Sections of the included patterns are not preserved, and all its actions are appended at the end of the first parameter
- _patterns_lab_include_pattern in includes/
forms/ lab.inc - Returns the portion of a pattern object to be included as a string, depending on the passed mode of exporting.
- _patterns_parser_retrieve_actions_from_include in includes/
parser/ parser.inc - Returns all the actions from a pattern array. Sections are not preserved.
File
- includes/
parser/ parser.inc, line 684
Code
function patterns_parser_extract_all_actions($pattern, $options, $sections = NULL) {
$actions = array();
$pattern = _patterns_db_get_pattern_array($pattern);
if (!$pattern) {
return $actions;
}
if (isset($pattern['pattern'])) {
$pattern = $pattern['pattern'];
}
// Loop through the sections of the included pattern
foreach ($pattern as $section => $value) {
if (in_array($section, array(
'info',
'modules',
))) {
continue;
}
if (!is_null($sections) && !in_array($section, $sections)) {
continue;
}
$newactions = patterns_parser_retrieve_actions_from_section($value, $options);
$actions = array_merge($actions, $newactions);
}
return $actions;
}