You are here

function patterns_db_get_patterns in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/ \patterns_db_get_patterns()

Returns the array of patterns objects that are currently in the database.

No further check against the file system is performed. It just returns what is in the database.

It is possible to specify which fields to return with a parameter, that can be either a string or an array.

The pattern code within each each object is still to be unserialized.


mixed $fields Specifies which fields to return.:

Return value

array An array of all available patterns objects.

See also


6 calls to patterns_db_get_patterns()
PatternsExportTestCase::testExportTaxonomy in tests/exporting/exporting.test
patterns_db_get_patterns_array in includes/
Returns the array of patterns loaded from the database.
patterns_examples_disable in patterns_examples/patterns_examples.install
Implements hook_uninstall().
patterns_lab in includes/forms/
@file Functions related to exporting patterns.
patterns_lab_submit in includes/forms/
Exports selected patterns either in a file or as a zip-archive

... See full list


includes/, line 296
Retrieve, save, and remove patterns from the database.


function patterns_db_get_patterns($fields = array()) {
  if (!empty($fields)) {
    if (!is_array($fields)) {
      $fields = array(
  $query = db_select('patterns', 'p');
  $result = $query
    ->fields('p', $fields)
  return $result;