You are here

function patterns_get_pattern in Patterns 6.2

Same name and namespace in other branches
  1. 5 patterns.module \patterns_get_pattern()
  2. 6 patterns.module \patterns_get_pattern()
  3. 7.2 includes/db.inc \patterns_get_pattern()
  4. 7 includes/db.inc \patterns_get_pattern()
12 calls to patterns_get_pattern()
drush_patterns_enable in ./patterns.drush.inc
Enables the specified pattern
drush_patterns_info in ./patterns.drush.inc
patterns list command callback.
drush_patterns_run in ./patterns.drush.inc
Imports, Enables, and Runs the specified pattern file
patterns_edit in ./patterns.module
Menu callback to edit a patterns data
patterns_enable_pattern in ./patterns.module

... See full list

File

./patterns.module, line 1074
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_get_pattern($id) {
  if (is_numeric($id)) {
    $pattern = db_fetch_object(db_query("SELECT * FROM {patterns} WHERE pid = '%d'", $id));
  }
  else {
    if (is_string($id)) {
      $pattern = db_fetch_object(db_query("SELECT * FROM {patterns} WHERE name = '%s'", $id));
    }
  }
  if (!$pattern) {
    return FALSE;
  }

  // Get the actual data. Data is stored in serialized form in the db.
  $pattern->pattern = unserialize($pattern->pattern);
  return $pattern;
}