public StorageReplaceDataWrapper::listAll($prefix = '')
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 128
Class
- StorageReplaceDataWrapper
- Wraps a configuration storage to allow replacing specific configuration data.
Namespace
Drupal\config
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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 ; } |
Please login to continue.