public function PresetDeleteForm::submitForm in Video 8.2
The submit handler for the confirm form.
For entity delete forms, you use this to delete the entity in $this->entity.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: An associative array containing the current state of the form.
Throws
\Drupal\Core\Entity\EntityStorageException
Overrides EntityForm::submitForm
File
- modules/
video_transcode/ src/ Form/ PresetDeleteForm.php, line 80
Class
- PresetDeleteForm
- Class PresetDeleteForm.
Namespace
Drupal\video_transcode\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Delete the entity.
$this->entity
->delete();
// Set a message that the entity was deleted.
$this
->messenger()
->addStatus($this
->t('Preset %label was deleted.', [
'%label' => $this->entity
->label(),
]));
// Redirect the user to the list controller when complete.
$form_state
->setRedirectUrl($this
->getCancelUrl());
}