You are here

public function InMemoryStorage::listAll in Configuration Provider 8

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

src/InMemoryStorage.php, line 121

Class

InMemoryStorage
Provides an in memory confituration storage.

Namespace

Drupal\config_provider

Code

public function listAll($prefix = '') {
  $names = [];
  if ($prefix === '') {
    $names = array_keys($this->config[$this->collection]);
  }
  else {
    foreach (array_keys($this->config[$this->collection]) as $name) {
      if (strpos($name, $prefix) === 0) {
        $names[] = $name;
      }
    }
  }
  return $names;
}