This repository has been archived on 2022-07-12. You can view files and clone it, but cannot push or open issues or pull requests.
2018-04-29 11:58:46 +00:00
|
|
|
<?php
|
|
|
|
|
2021-02-18 12:02:25 +00:00
|
|
|
namespace Drupal\opencase_cases\Form;
|
2018-04-29 11:58:46 +00:00
|
|
|
|
|
|
|
use Drupal\Core\Entity\EntityConfirmFormBase;
|
|
|
|
use Drupal\Core\Form\FormStateInterface;
|
|
|
|
use Drupal\Core\Url;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds the form to delete Case type entities.
|
|
|
|
*/
|
|
|
|
class OCCaseTypeDeleteForm 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('entity.oc_case_type.collection');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getConfirmText() {
|
|
|
|
return $this->t('Delete');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function submitForm(array &$form, FormStateInterface $form_state) {
|
|
|
|
$this->entity->delete();
|
|
|
|
|
2021-11-27 15:19:16 +00:00
|
|
|
\Drupal::messenger()->addMessage(
|
2018-04-29 11:58:46 +00:00
|
|
|
$this->t('content @type: deleted @label.',
|
|
|
|
[
|
|
|
|
'@type' => $this->entity->bundle(),
|
|
|
|
'@label' => $this->entity->label(),
|
|
|
|
]
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$form_state->setRedirectUrl($this->getCancelUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|