TaskForm.php in General Data Protection Regulation 8.2
File
modules/gdpr_tasks/src/Form/TaskForm.php
View source
<?php
namespace Drupal\gdpr_tasks\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
class TaskForm extends ContentEntityForm {
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = parent::save($form, $form_state);
switch ($status) {
case SAVED_NEW:
$this
->messenger()
->addStatus($this
->t('Created the %label Task.', [
'%label' => $entity
->label(),
]));
break;
default:
$this
->messenger()
->addStatus($this
->t('Saved the %label Task.', [
'%label' => $entity
->label(),
]));
}
$form_state
->setRedirect('entity.gdpr_task.canonical', [
'gdpr_task' => $entity
->id(),
]);
}
}
Classes
Name |
Description |
TaskForm |
Form controller for Task edit forms. |