PushNotificationDeleteForm.php in Push Notifications 8
Namespace
Drupal\push_notifications\FormFile
src/Form/PushNotificationDeleteForm.phpView source
<?php
/**
* @file
* Contains Drupal\push_notifications\Form\PushNotificationDeleteForm.
*/
namespace Drupal\push_notifications\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Provides a form for deleting a push_notification entity.
*
* @ingroup push_notifications
*/
class PushNotificationDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delete entity %name?', array(
'%name' => $this->entity
->label(),
));
}
/**
* {@inheritdoc}
*
* If the delete command is canceled, return to the push notifications list.
*/
public function getCancelUrl() {
return new Url('entity.push_notification.collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete Push Notification');
}
/**
* {@inheritdoc}
*
* Delete the entity and log the event. logger() replaces the watchdog.
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this
->getEntity();
$entity
->delete();
$this
->logger('push_notifications')
->notice('@type: deleted %title.', array(
'@type' => $this->entity
->bundle(),
'%title' => $this->entity
->label(),
));
$form_state
->setRedirect('entity.push_notification.collection');
}
}
Classes
Name | Description |
---|---|
PushNotificationDeleteForm | Provides a form for deleting a push_notification entity. |