diff --git a/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php b/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php index 7cd33ab..9cd3f7a 100644 --- a/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php +++ b/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php @@ -5,6 +5,7 @@ use Drupal\Core\Extension\ModuleUninstallValidatorInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; +use Drupal\Core\Url; /** * Validates module uninstall readiness based on existing content entities. @@ -37,10 +38,14 @@ public function __construct(EntityManagerInterface $entity_manager, TranslationI */ public function validate($module) { $entity_types = $this->entityManager->getDefinitions(); - $reasons = array(); + $reasons = []; foreach ($entity_types as $entity_type) { if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) { - $reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel())); + $reasons[] = $this->t('There is content for the entity type: @entity_type. Remove @entity_type_plural.', [ + '@entity_type' => $entity_type->getLabel(), + '@entity_type_plural' => $entity_type->getPluralLabel(), + ':link' => Url::fromRoute('system.prepare_modules_entity_uninstall', ['entity_type_id' => $entity_type->id()])->toString(), + ]); } } return $reasons; diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 547b083..6927d6b 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -423,6 +423,14 @@ system.modules_uninstall_confirm: requirements: _permission: 'administer modules' +system.prepare_modules_entity_uninstall: + path: '/admin/modules/uninstall/entity/{entity_type_id}' + defaults: + _form: '\Drupal\system\Form\PrepareModulesEntityUninstallForm' + _title_callback: '\Drupal\system\Form\PrepareModulesEntityUninstallForm::formTitle' + requirements: + _permission: 'administer modules' + system.timezone: path: '/system/timezone/{abbreviation}/{offset}/{is_daylight_saving_time}' defaults: diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php index 9beac7a..1531536 100644 --- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php +++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php @@ -37,16 +37,6 @@ protected function setUp() { } /** - * {@inheritdoc} - */ - public function register(ContainerBuilder $container) { - parent::register($container); - // Put a fake route bumper on the container to be called during uninstall. - $container - ->register('router.dumper', 'Drupal\Core\Routing\NullMatcherDumper'); - } - - /** * The basic functionality of retrieving enabled modules. */ function testModuleList() {