1.20.x config_database_storage.inc | public ConfigDatabaseStorage::listAll($prefix = '') |
Gets configuration object names starting with a given prefix.
Given the following configuration objects:
- node.type.post
- node.type.page
Passing the prefix 'node.type.' will return an array containing the above names.
Parameters
string $prefix: (optional) The prefix to search for. If omitted, all configuration object names that exist are returned.
Return value
array: An array containing matching configuration object names.
Overrides ConfigStorageInterface::listAll
File
- drivers/
config_database/ config_database_storage.inc, line 301
Class
- ConfigDatabaseStorage
- Defines the database storage controller.
Code
public function listAll($prefix = '') {
$results = db_select($this->table, 'c', array('target' => $this->database))
->fields('c', array('name'))
->condition('c.name', $prefix . '%', 'LIKE')
->execute()
->fetchAllAssoc('name', PDO::FETCH_ASSOC);
return array_column($results, 'name');
}