You are here

function _patterns_db_get_pattern_array in Patterns 7

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

Returns the array representation of a pattern from different input parameters.

Returns FALSE in case of errors.

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

2 calls to _patterns_db_get_pattern_array()
patterns_install_modules_in_pattern in ./patterns.module
Extract all the values of the modules tag from a pattern and returns them as an array.
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/db.inc, line 69
Retrieve, save, and remove patterns from the database.

Code

function _patterns_db_get_pattern_array($pattern) {
  if (is_null($pattern)) {
    return FALSE;
  }
  if (is_array($pattern)) {
    return $pattern;
  }
  if (!is_object($pattern)) {
    $pattern = patterns_get_pattern($pattern);
  }

  // is standard class obj
  return get_object_vars($pattern);
}