public function StorageReplaceDataWrapper::listAll in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/config/src/StorageReplaceDataWrapper.php \Drupal\config\StorageReplaceDataWrapper::listAll()
Gets configuration object names starting with a given prefix.
Given the following configuration objects:
- node.type.article
- 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 StorageInterface::listAll
File
- core/
modules/ config/ src/ StorageReplaceDataWrapper.php, line 132 - Contains \Drupal\config\StorageReplaceDataWrapper.
Class
- StorageReplaceDataWrapper
- Wraps a configuration storage to allow replacing specific configuration data.
Namespace
Drupal\configCode
public function listAll($prefix = '') {
$names = $this->storage
->listAll($prefix);
$additional_names = [];
if ($prefix === '') {
$additional_names = array_keys($this->replacementData[$this->collection]);
}
else {
foreach (array_keys($this->replacementData[$this->collection]) as $name) {
if (strpos($name, $prefix) === 0) {
$additional_names[] = $name;
}
}
}
if (!empty($additional_names)) {
$names = array_unique(array_merge($names, $additional_names));
}
return $names;
}