diff --git a/core/modules/block_content/src/Form/BlockContentDeleteForm.php b/core/modules/block_content/src/Form/BlockContentDeleteForm.php index fe0759cc16d..3a77b65f65b 100644 --- a/core/modules/block_content/src/Form/BlockContentDeleteForm.php +++ b/core/modules/block_content/src/Form/BlockContentDeleteForm.php @@ -3,7 +3,6 @@ namespace Drupal\block_content\Form; use Drupal\Core\Entity\ContentEntityDeleteForm; -use Drupal\Core\Form\FormStateInterface; /** * Provides a confirmation form for deleting a custom block entity. @@ -15,15 +14,12 @@ class BlockContentDeleteForm extends ContentEntityDeleteForm { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state) { + public function getDescription() { $instances = $this->entity->getInstances(); - - $form['message'] = [ - '#markup' => $this->formatPlural(count($instances), 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instances.'), - '#access' => !empty($instances), - ]; - - return parent::buildForm($form, $form_state); + if (!empty($instances)) { + return $this->formatPlural(count($instances), 'This will also remove 1 placed block instance. This action cannot be undone.', 'This will also remove @count placed block instances. This action cannot be undone.'); + } + return parent::getDescription(); } }