1 config.inc public ConfigDatabaseStorage::exists($name)

Returns whether a configuration object exists.

Parameters

string $name: The name of a configuration object to test.

Return value

bool: TRUE if the configuration object exists, FALSE otherwise.

Overrides ConfigStorageInterface::exists

File

core/includes/config.inc, line 1375
This is the API for configuration storage.

Class

ConfigDatabaseStorage
Defines the database storage controller.

Code

public function exists($name) {
  try {
    $query = db_select($this->table, 'c', array('target' => $this->database))
      ->condition('c.name', $name);
    $query->addExpression('1');
    $value = $query->execute()
      ->fetchField();
  }
  catch (\Exception $e) {
    // Happens where there is no database.  Return FALSE.
    $value = FALSE;
  }

  return (bool) $value;
}