You are here

FlagListItemDeleteForm.php in Flag Lists 8

Same filename and directory in other branches
  1. 4.0.x src/Form/FlagListItemDeleteForm.php

File

src/Form/FlagListItemDeleteForm.php
View source
<?php

namespace Drupal\flag_lists\Form;

use Drupal\Core\Entity\ContentEntityDeleteForm;
use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a form for deleting Flag List Item entities.
 *
 * @ingroup flag_lists
 */
class FlagListItemDeleteForm extends ContentEntityDeleteForm {

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $entity = $this
      ->getEntity();
    $form = parent::buildForm($form, $form_state);
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = $this
      ->getEntity();
    $entity
      ->delete();
    $message = $this
      ->getDeletionMessage();
    $this
      ->messenger()
      ->addStatus($message);
    $this
      ->logDeletionMessage();
  }

}

Classes

Namesort descending Description
FlagListItemDeleteForm Provides a form for deleting Flag List Item entities.