You are here

public function MemoryStorage::getAllCollectionNames in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::getAllCollectionNames()
  2. 9 core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::getAllCollectionNames()

Gets the existing collections.

A configuration storage can contain multiple sets of configuration objects in partitioned collections. The collection key name identifies the current collection used.

Return value

array An array of existing collection names.

Overrides StorageInterface::getAllCollectionNames

File

core/lib/Drupal/Core/Config/MemoryStorage.php, line 166

Class

MemoryStorage
Provides an in memory configuration storage.

Namespace

Drupal\Core\Config

Code

public function getAllCollectionNames() {
  $collection_names = [];
  foreach ($this->config as $collection_name => $data) {

    // Exclude the default collection and empty collections.
    if ($collection_name !== StorageInterface::DEFAULT_COLLECTION && !empty($data)) {
      $collection_names[] = $collection_name;
    }
  }
  sort($collection_names);
  return $collection_names;
}