3 namespace Drupal\paragraphs\Form;
5 use Drupal\Core\Entity\EntityDeleteForm;
6 use Drupal\Core\Form\FormStateInterface;
9 * Provides a form for Paragraphs type deletion.
11 class ParagraphsTypeDeleteConfirm extends EntityDeleteForm {
16 public function buildForm(array $form, FormStateInterface $form_state) {
17 $num_paragraphs = $this->entityTypeManager->getStorage('paragraph')->getQuery()
18 ->condition('type', $this->entity->id())
21 if ($num_paragraphs) {
22 $caption = '<p>' . $this->formatPlural($num_paragraphs, '%type Paragraphs type is used by 1 piece of content on your site. You can not remove this %type Paragraphs type until you have removed all from the content.', '%type Paragraphs type is used by @count pieces of content on your site. You may not remove %type Paragraphs type until you have removed all from the content.', ['%type' => $this->entity->label()]) . '</p>';
23 $form['#title'] = $this->getQuestion();
24 $form['description'] = ['#markup' => $caption];
28 return parent::buildForm($form, $form_state);