You are here

function patterns_parser_retrieve_actions_from_section in Patterns 7

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

Returns all the actions from a a given section

Parameters

array $section:

array $pattern the pattern to scan:

3 calls to patterns_parser_retrieve_actions_from_section()
patterns_execute_pattern_batch in includes/core/batch.inc
Starts preliminary operations for pattern execution.
patterns_execute_pattern_php in includes/core/php.inc
Execute a Pattern. Actions will be called sequentially.
patterns_parser_extract_all_actions in includes/parser/parser.inc
Extract all the actions from a pattern and returns them as an array.

File

includes/parser/parser.inc, line 493

Code

function patterns_parser_retrieve_actions_from_section($section, $options = array()) {
  if (empty($section)) {
    return FALSE;
  }
  $actions = array();
  foreach ($section as $key => $value) {
    $action = key($value);
    if (in_array($action, patterns_actions())) {
      if ($action !== PATTERNS_INCLUDE) {
        $actions[] = $section[$key];
      }
      else {
        $include = $value[PATTERNS_INCLUDE];
        if (patterns_parser_should_include_local($include, $options)) {

          // $actions is passed as reference
          patterns_parser_include_pattern($actions, $include['pattern'], $options);

          //            $new_actions =  _patterns_parser_retrieve_actions_from_include($include, $options);
          //            $actions = array_merge($actions, $new_actions);
        }
      }
    }
  }
  return $actions;
}