You are here

function patterns_parser_include_pattern in Patterns 7

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

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

Parameters

array &$actions the including pattern, or a subset of actions of it:

array $include the included pattern:

array $options the include options for nested patterns included: in the included patterns.

array $sections array containing the name of the sections,: from which extract the actions. If NULL, all the sections will be scanned.

1 call to patterns_parser_include_pattern()
patterns_parser_retrieve_actions_from_section in includes/parser/parser.inc
Returns all the actions from a a given section

File

includes/parser/parser.inc, line 561

Code

function patterns_parser_include_pattern(&$actions, $include, $options = array(), $sections = NULL) {
  if (empty($include)) {
    return $actions;
  }
  if (is_array($include) && isset($include['pattern'])) {

    // take the code / id / name
    $include = $include['pattern'];
  }
  if (!patterns_install_modules_in_pattern($include)) {
    drupal_set_message(t('Failed to load the necessary modules for the included pattern. Its actions will not be executed.'));
    return $actions;
  }

  // Success
  $new_actions = patterns_parser_extract_all_actions($include, $options);
  $actions = array_merge($actions, $new_actions);
}