You are here

function patterns_db_load_pattern_from_name in Patterns 7.2

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

Loads a pattern object from the database based on the given name.

Parameters

$name:

2 calls to patterns_db_load_pattern_from_name()
_patterns_import_check_name in includes/forms/import.inc
Helper function to be called in one of the import validation handlers.
_patterns_io_import_check_name in includes/io/import.inc
Helper function to be called in one of the import validation handlers.

File

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

Code

function patterns_db_load_pattern_from_name($name = NULL) {
  if (empty($name)) {
    return FALSE;
  }
  $query = db_select('patterns', 'p');
  $result = $query
    ->condition('name', $name)
    ->fields('p')
    ->execute()
    ->fetchObject();
  if (!empty($result)) {
    return $result;
  }
  else {
    return FALSE;
  }
}