public function SyncConfigCollector::alterConfigSnapshots in Configuration Synchronizer 8.2
Alters configuration snapshots.
In certain cases, the configuration suitable for snapshotting will differ from that suitable for comparing to a snapshot. The snapshot should reflect the current installed state. If alters are in effect, the snapshot should be updated accordingly as a new module is installed or updated.
Parameters
\Drupal\Core\Extension\Extension[] $extensions: (Optional) An associative array of Extension objects, keyed by extension name. If provided, data loaded will be limited to these extensions.
Overrides SyncConfigCollectorInterface::alterConfigSnapshots
File
- src/
Plugin/ SyncConfigCollector.php, line 42
Class
- SyncConfigCollector
- Class for invoking configuration providers.
Namespace
Drupal\config_sync\PluginCode
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);
}
}
}
}
}