You are here

function _patterns_parser_retrieve_actions_from_include in Patterns 7.2

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

Returns all the actions from a pattern array. Sections are not preserved.

Parameters

$include the pattern to scan:

array $sections include only these sections (not used for now):

File

includes/parser/parser.inc, line 449

Code

function _patterns_parser_retrieve_actions_from_include($include, $options, $sections = NULL) {
  $actions = array();
  if (!isset($include['pattern']) || empty($include['pattern'])) {
    return $actions;
  }

  // if pattern is an id or a name,
  // try to load it from the database
  if (!is_array($include['pattern'])) {
    $p = patterns_get_pattern($include['pattern']);
    if (!$p) {
      drupal_set_message(t('Failed to include pattern %pattern'), array(
        '%pattern' => $include['pattern'],
      ));
      return $actions;
    }
    $include['pattern'] = $p->pattern;
  }
  return patterns_parser_extract_all_actions($include['pattern'], $options, $sections);
}