CustomPermsEntityDeleteForm.php in Custom Permissions 8
Same filename and directory in other branches
Namespace
Drupal\config_perms\FormFile
src/Form/CustomPermsEntityDeleteForm.phpView source
<?php
namespace Drupal\config_perms\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Builds the form to delete Custom perms entity entities.
*/
class CustomPermsEntityDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delete %name?', [
'%name' => $this->entity
->label(),
]);
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return new Url('custom_perms_select_list_form');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
drupal_set_message($this
->t('content @type: deleted @label.', [
'@type' => $this->entity
->bundle(),
'@label' => $this->entity
->label(),
]));
\Drupal::service('router.builder')
->rebuild();
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}
Classes
Name | Description |
---|---|
CustomPermsEntityDeleteForm | Builds the form to delete Custom perms entity entities. |