You are here

function patterns_db_get_enabled_patterns in Patterns 7.2

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

Returns the array of patterns objects that are currently enabled.

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

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

Parameters

mixed $fields Specifies which fields to return.:

1 call to patterns_db_get_enabled_patterns()
patterns_db_get_enabled_patterns_array in includes/db.inc
Returns the array of patterns array that are currently enabled.

File

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

Code

function patterns_db_get_enabled_patterns($fields = array()) {
  if (!empty($fields)) {
    if (!is_array($fields)) {
      $fields = array(
        $fields,
      );
    }
  }
  $query = db_select('patterns', 'p');
  $result = $query
    ->condition('status', PATTERNS_STATUS_ENABLED)
    ->fields('p', $fields)
    ->execute()
    ->fetchAll();
  return $result;
}