diff --git a/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php b/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php index c05cfad..b9552e1 100644 --- a/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php +++ b/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php @@ -41,7 +41,7 @@ public function validate($module) { $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. Remove @entity_type entities.', [ + $reasons[] = $this->t('There is content for the entity type: @entity_type. Remove @entity_type_plural.', [ '@entity_type' => $entity_type->getLabel(), ':link' => Url::fromRoute('system.prepare_modules_entity_uninstall', ['entity_type_id' => $entity_type->id()])->toString(), ]); diff --git a/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php b/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php index cf7e80f..93e9485 100644 --- a/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php +++ b/core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php @@ -46,10 +46,11 @@ public function getDescription() { $count = \Drupal::entityQuery($this->entityTypeId)->count()->execute(); return $this->formatPlural($count, - 'There is 1 @entity_type entity to remove.', - 'There are @count @entity_type entities to remove.', + 'There is 1 @entity_type_singular entity to remove.', + 'There are @count @entity_type_plural to remove.', [ - '@entity_type' => $entity_type->getLabel() + '@entity_type_singular' => $entity_type->getSingularLabel(), + '@entity_type_plural' => $entity_type->getPluralLabel(), ] ) . ' ' . @@ -61,8 +62,8 @@ public function getDescription() { */ public function getConfirmText() { $entity_type = \Drupal::entityTypeManager()->getDefinition($this->entityTypeId); - return $this->t('Delete all @entity_type entities', [ - '@entity_type' => $entity_type->getLabel(), + return $this->t('Delete all @entity_type_plural', [ + '@entity_type_plural' => $entity_type->getPluralLabel(), ]); } @@ -94,8 +95,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id); $batch = [ - 'title' => t('Deleting @entity_type data', [ - '@entity_type' => $entity_type->getLabel(), + 'title' => t('Deleting @entity_type_plural', [ + '@entity_type_plural' => $entity_type->getPluralLabel(), ]), 'operations' => [ [ @@ -103,8 +104,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ], ], 'finished' => [__CLASS__, 'moduleBatchFinished'], - 'progress_message' => static::t('Deleting @entity_type data... Completed @percentage% (@current of @total).', [ - '@entity_type' => $entity_type->getLabel(), + 'progress_message' => static::t('Deleting @entity_type_plural... Completed @percentage% (@current of @total).', [ + '@entity_type_plural' => $entity_type->getPluralLabel(), ]), ]; batch_set($batch); @@ -127,7 +128,7 @@ public static function deleteContentEntities($entity_type_id, &$context) { /* @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */ $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id); - $context['results']['entity_type'] = $entity_type->getLabel(); + $context['results']['entity_type_plural'] = ucfirst($entity_type->getPluralLabel()); } /** @@ -137,8 +138,8 @@ public static function deleteContentEntities($entity_type_id, &$context) { * successful data deletion message. */ public static function moduleBatchFinished($success, $results, $operations) { - drupal_set_message(t('@entity_type data has been deleted.', [ - '@entity_type' => $results['entity_type'], + drupal_set_message(t('@entity_type_plural have been deleted.', [ + '@entity_type_plural' => $results['entity_type_plural'], ])); return new RedirectResponse(Url::fromRoute('system.modules_uninstall')->setAbsolute()->toString()); } diff --git a/core/modules/system/src/Tests/Module/PrepareUninstallTest.php b/core/modules/system/src/Tests/Module/PrepareUninstallTest.php index d92c61f..c20c645 100644 --- a/core/modules/system/src/Tests/Module/PrepareUninstallTest.php +++ b/core/modules/system/src/Tests/Module/PrepareUninstallTest.php @@ -44,17 +44,17 @@ public function testUninstall() { // Check Node cannot be uninstalled yet, there is content to be removed. $this->drupalGet('admin/modules/uninstall'); - $this->assertText(t('Remove Content entities')); + $this->assertText(t('Remove content items')); $this->assertLinkByHref('admin/modules/uninstall/entity/node'); // Delete Node data. $this->drupalGet('admin/modules/uninstall/entity/node'); - $this->assertText(t('There are 4 Content entities to remove. This action cannot be undone.')); - $this->drupalPostForm(NULL, [], t('Delete all Content entities')); + $this->assertText(t('There are 4 content items to remove. This action cannot be undone.')); + $this->drupalPostForm(NULL, [], t('Delete all content items')); // Check we are redirected to the uninstall page and data has been removed. $this->assertUrl('admin/modules/uninstall', []); - $this->assertText(t('Content data has been deleted.')); + $this->assertText(t('Content items have been deleted.')); // Check there is no more data to be deleted, Node is ready to be disabled. $this->assertText(t('Allows content to be submitted to the site and displayed on pages.'));