trait ConfigSyncActiveStoragesTrait in Configuration Synchronizer 8.2
Provides a utility method for fetching the active storage by collection.
Hierarchy
- trait \Drupal\config_sync\ConfigSyncActiveStoragesTrait
File
- src/
ConfigSyncActiveStoragesTrait.php, line 10
Namespace
Drupal\config_syncView source
trait ConfigSyncActiveStoragesTrait {
/**
* The active configuration storages, keyed by collection.
*
* @var \Drupal\Core\Config\StorageInterface[]
*/
protected $activeStorages;
/**
* Gets the configuration storage that provides the active configuration.
*
* @param string $collection
* (optional) The configuration collection. Defaults to the default
* collection.
*
* @return \Drupal\Core\Config\StorageInterface
* The configuration storage that provides the default configuration.
*/
protected function getActiveStorages($collection = StorageInterface::DEFAULT_COLLECTION) {
if (!isset($this->activeStorages[$collection])) {
$this->activeStorages[$collection] = reset($this->activeStorages)
->createCollection($collection);
}
return $this->activeStorages[$collection];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSyncActiveStoragesTrait:: |
protected | property | The active configuration storages, keyed by collection. | |
ConfigSyncActiveStoragesTrait:: |
protected | function | Gets the configuration storage that provides the active configuration. |