function MemoryStorage::getAllCollectionNames

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::getAllCollectionNames()
  2. 8.9.x core/lib/Drupal/Core/Config/MemoryStorage.php \Drupal\Core\Config\MemoryStorage::getAllCollectionNames()
  3. 11.x 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 167

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.