Implement save function to add message and redirect to collection page

This commit is contained in:
Paul Weidner 2024-01-30 15:07:16 -08:00 committed by Michael Stenta
parent 1cee2cb2e1
commit 52f968ef6c
1 changed files with 11 additions and 0 deletions

View File

@ -170,6 +170,17 @@ class QuickFormEntityForm extends EntityForm {
}
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$status = parent::save($form, $form_state);
$entity_type_label = $this->entity->getEntityType()->getSingularLabel();
$this->messenger()->addMessage($this->t('Saved @entity_type_label: %label', ['@entity_type_label' => $entity_type_label, '%label' => $this->entity->label()]));
$form_state->setRedirect('entity.quick_form.collection');
return $status;
}
/**
* {@inheritdoc}
*/