You are here

function _patterns_db_get_pattern in Patterns 7

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

Returns a pattern object 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

8 calls to _patterns_db_get_pattern()
patterns_db_analyze_patterns_status in includes/db.inc
Returns a string representation of the status of the pattern as it is in the database;
patterns_db_is_pattern_updated in includes/db.inc
Compares the date of the last update in the database with the one in the file system and return TRUE if the file system has a newer copy of the pattern stored in the database.
patterns_db_publish_pattern in includes/db.inc
Sets the flag public to FALSE in the database for the pattern with the specified pattern id.
patterns_db_unpublish_pattern in includes/db.inc
Sets the flag public to FALSE in the database for the pattern with the specified pattern id.
patterns_get_patterns_links in theme/common.inc

... See full list

File

includes/db.inc, line 47
Retrieve, save, and remove patterns from the database.

Code

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