class SyncConfigCollector in Configuration Synchronizer 8.2
Class for invoking configuration providers.
Hierarchy
- class \Drupal\config_sync\Plugin\SyncConfigCollector extends \Drupal\config_provider\Plugin\ConfigCollector implements SyncConfigCollectorInterface uses ConfigSnapshotStorageTrait, ConfigSyncExtensionsTrait
Expanded class hierarchy of SyncConfigCollector
1 string reference to 'SyncConfigCollector'
1 service uses SyncConfigCollector
File
- src/
Plugin/ SyncConfigCollector.php, line 13
Namespace
Drupal\config_sync\PluginView source
class SyncConfigCollector extends ConfigCollector implements SyncConfigCollectorInterface {
use ConfigSnapshotStorageTrait;
use ConfigSyncExtensionsTrait;
/**
* {@inheritdoc}
*/
public function addConfigForSnapshotting(array $extensions = []) {
// Start with an empty storage.
$this->providerStorage
->deleteAll();
foreach ($this->providerStorage
->getAllCollectionNames() as $collection) {
$provider_collection = $this->providerStorage
->createCollection($collection);
$provider_collection
->deleteAll();
}
/* @var \Drupal\config_provider\Plugin\ConfigProviderInterface[] $providers */
$providers = $this
->getConfigProviders();
foreach ($providers as $provider) {
if (!$provider instanceof SyncConfigProviderInterface) {
$provider
->addInstallableConfig($extensions);
}
}
}
/**
* {@inheritdoc}
*/
public function alterConfigSnapshots(array $extensions = []) {
/* @var \Drupal\config_provider\Plugin\ConfigProviderInterface[] $providers */
$providers = $this
->getConfigProviders();
// Iterate through all extensions.
$extension_names = $this
->getSyncExtensions();
foreach ($extension_names as $type => $names) {
foreach ($names as $name) {
$snapshot_storage = $this
->getConfigSnapshotStorage(ConfigSyncSnapshotterInterface::CONFIG_SNAPSHOT_SET, $type, $name);
// Pass the storage to each provider.
foreach ($providers as $provider) {
if ($provider instanceof SyncConfigProviderInterface) {
$provider
->alterConfigSnapshot($snapshot_storage, $extensions);
}
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSnapshotStorageTrait:: |
protected | function | Returns a configuration snapshot storage service. | |
ConfigSyncExtensionsTrait:: |
protected | function | ||
SyncConfigCollector:: |
public | function |
Adds configuration for snapshotting. Overrides SyncConfigCollectorInterface:: |
|
SyncConfigCollector:: |
public | function |
Alters configuration snapshots. Overrides SyncConfigCollectorInterface:: |