You are here

function patterns_get_pattern in Patterns 5

Same name and namespace in other branches
  1. 6.2 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()
8 calls to patterns_get_pattern()
patterns_disable_pattern in ./patterns.module
patterns_disable_pattern_submit in ./patterns.module
patterns_edit in ./patterns.module
Menu callback to edit a patterns data
patterns_enable_pattern in ./patterns.module
patterns_enable_pattern_submit in ./patterns.module

... See full list

File

./patterns.module, line 686
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));
    }
  }

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

  // Rearrange the data in a nice way for each component.
  // Make sure actions are processed differently so order is preserved.
  $pattern->pattern = patterns_rearrange_data($pattern->pattern);
  return $pattern;
}