1 config.inc public ConfigFileStorage::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.


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


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


Defines the file storage controller.


public function listAll($prefix = '') {
  // glob() silently ignores the error of a non-existing search directory,
  // even with the GLOB_ERR flag.
  if (!file_exists($this->directory)) {
    throw new ConfigStorageException($this->directory . '/ not found.');
  $extension = '.json';
  $files = glob($this->directory . '/' . $prefix . '*' . $extension);
  $clean_name = function($value) use ($extension) {
    return basename($value, $extension);
  return array_map($clean_name, $files);