public function SystemConfigSubscriber::onConfigImporterValidateNotEmpty in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigImporterValidateNotEmpty()
Checks that the configuration synchronization is valid.
This event listener prevents deleting all configuration. If there is nothing to import then event propagation is stopped because there is no config import to validate.
Parameters
\Drupal\Core\Config\ConfigImporterEvent $event: The config import event.
File
- core/
modules/ system/ src/ SystemConfigSubscriber.php, line 62 - Contains \Drupal\system\SystemConfigSubscriber.
Class
- SystemConfigSubscriber
- System Config subscriber.
Namespace
Drupal\systemCode
public function onConfigImporterValidateNotEmpty(ConfigImporterEvent $event) {
$importList = $event
->getConfigImporter()
->getStorageComparer()
->getSourceStorage()
->listAll();
if (empty($importList)) {
$event
->getConfigImporter()
->logError($this
->t('This import is empty and if applied would delete all of your configuration, so has been rejected.'));
$event
->stopPropagation();
}
}