diff --git a/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php index 5cc1a95..60f7182 100644 --- a/core/lib/Drupal/Core/Config/ConfigImporter.php +++ b/core/lib/Drupal/Core/Config/ConfigImporter.php @@ -8,7 +8,10 @@ namespace Drupal\Core\Config; use Drupal\Core\Config\ConfigEvents; +use Drupal\Core\Config\Entity\ConfigStorageControllerInterface; +use Drupal\Core\Config\Entity\ImportableEntityStorageInterface; use Drupal\Core\DependencyInjection\DependencySerialization; +use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Lock\LockBackendInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -297,9 +300,6 @@ protected function importConfig($op, $name) { * otherwise. */ protected function importInvokeOwner($op, $name) { - // Call to the configuration entity's storage controller to handle the - // configuration change. - $handled_by_module = FALSE; // Validate the configuration object name before importing it. // Config::validateName($name); if ($entity_type = $this->configManager->getEntityTypeIdByName($name)) { @@ -315,9 +315,13 @@ protected function importInvokeOwner($op, $name) { } $method = 'import' . ucfirst($op); - $handled_by_module = $this->configManager->getEntityManager()->getStorageController($entity_type)->$method($name, $new_config, $old_config); - } - if (!empty($handled_by_module)) { + $entity_storage = $this->configManager->getEntityManager()->getStorageController($entity_type); + // Call to the configuration entity's storage controller to handle the + // configuration change. + if (!($entity_storage instanceof ImportableEntityStorageInterface)) { + throw new EntityStorageException('The entity storage does not support imports'); + } + $entity_storage->$method($name, $new_config, $old_config); $this->setProcessed($op, $name); return TRUE; } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 8a26ec0..84a4384 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -35,7 +35,7 @@ * after the config_prefix in a config name forms the entity ID. Additional or * custom suffixes are not possible. */ -class ConfigStorageController extends EntityStorageControllerBase implements ConfigStorageControllerInterface { +class ConfigStorageController extends EntityStorageControllerBase implements ConfigStorageControllerInterface, ImportableEntityStorageInterface { /** * The UUID service. diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageControllerInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageControllerInterface.php index 4ffe876..e479b7f 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageControllerInterface.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageControllerInterface.php @@ -16,51 +16,6 @@ interface ConfigStorageControllerInterface extends EntityStorageControllerInterface { /** - * Create configuration upon synchronizing configuration changes. - * - * This callback is invoked when configuration is synchronized between storages - * and allows a module to take over the synchronization of configuration data. - * - * @param string $name - * The name of the configuration object. - * @param \Drupal\Core\Config\Config $new_config - * A configuration object containing the new configuration data. - * @param \Drupal\Core\Config\Config $old_config - * A configuration object containing the old configuration data. - */ - public function importCreate($name, Config $new_config, Config $old_config); - - /** - * Updates configuration upon synchronizing configuration changes. - * - * This callback is invoked when configuration is synchronized between storages - * and allows a module to take over the synchronization of configuration data. - * - * @param string $name - * The name of the configuration object. - * @param \Drupal\Core\Config\Config $new_config - * A configuration object containing the new configuration data. - * @param \Drupal\Core\Config\Config $old_config - * A configuration object containing the old configuration data. - */ - public function importUpdate($name, Config $new_config, Config $old_config); - - /** - * Delete configuration upon synchronizing configuration changes. - * - * This callback is invoked when configuration is synchronized between storages - * and allows a module to take over the synchronization of configuration data. - * - * @param string $name - * The name of the configuration object. - * @param \Drupal\Core\Config\Config $new_config - * A configuration object containing the new configuration data. - * @param \Drupal\Core\Config\Config $old_config - * A configuration object containing the old configuration data. - */ - public function importDelete($name, Config $new_config, Config $old_config); - - /** * Returns the config prefix used by the configuration entity type. * * @return string diff --git a/core/lib/Drupal/Core/Config/Entity/ImportableEntityStorageInterface.php b/core/lib/Drupal/Core/Config/Entity/ImportableEntityStorageInterface.php new file mode 100644 index 0000000..39ae1df --- /dev/null +++ b/core/lib/Drupal/Core/Config/Entity/ImportableEntityStorageInterface.php @@ -0,0 +1,57 @@ +