You are here

function patterns_install_modules_in_pattern in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns.module \patterns_install_modules_in_pattern()

Extract all the values of the modules tag from a pattern and returns them as an array.

If succesfull returns TRUE, FALSE otherwise.

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 is the only input that does not get further converted.

1 call to patterns_install_modules_in_pattern()
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

File

./patterns.module, line 907

Code

function patterns_install_modules_in_pattern($pattern) {
  $pattern = _patterns_db_get_pattern_array($pattern);
  if (!$pattern) {
    return FALSE;
  }
  $modules = patterns_parser_extract_modules($pattern);
  $results = patterns_install_modules($modules);
  if (!$results['success']) {

    // TODO: handle properly.
    drupal_set_message($results['error_message'], 'error');
    return FALSE;
  }
  return TRUE;
}