Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php
- 9 core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php
Namespace
Drupal\Core\EventSubscriber
File
core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php
View source
<?php
namespace Drupal\Core\EventSubscriber;
use Drupal\Core\Config\ConfigEvents;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\ConfigImporterEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ConfigSnapshotSubscriber implements EventSubscriberInterface {
protected $configManager;
protected $sourceStorage;
protected $snapshotStorage;
public function __construct(ConfigManagerInterface $config_manager, StorageInterface $source_storage, StorageInterface $snapshot_storage) {
$this->configManager = $config_manager;
$this->sourceStorage = $source_storage;
$this->snapshotStorage = $snapshot_storage;
}
public function onConfigImporterImport(ConfigImporterEvent $event) {
$this->configManager
->createSnapshot($this->sourceStorage, $this->snapshotStorage);
}
public static function getSubscribedEvents() : array {
$events[ConfigEvents::IMPORT][] = [
'onConfigImporterImport',
40,
];
return $events;
}
}
Classes