public function TagForm::save in Extensible BBCode 8.3
Same name and namespace in other branches
- 4.0.x src/Form/TagForm.php \Drupal\xbbcode\Form\TagForm::save()
Throws
\Drupal\Core\Entity\EntityMalformedException
\Drupal\Core\Entity\Exception\UndefinedLinkTemplateException
Overrides EntityForm::save
File
- src/
Form/ TagForm.php, line 186
Class
- TagForm
- Base form for creating and editing custom tags.
Namespace
Drupal\xbbcode\FormCode
public function save(array $form, FormStateInterface $form_state) : int {
$result = parent::save($form, $form_state);
if ($result === SAVED_NEW) {
$this
->messenger()
->addStatus($this
->t('The BBCode tag %tag has been created.', [
'%tag' => $this->entity
->label(),
]));
}
elseif ($result === SAVED_UPDATED) {
$this
->messenger()
->addStatus($this
->t('The BBCode tag %tag has been updated.', [
'%tag' => $this->entity
->label(),
]));
}
$form_state
->setRedirectUrl($this->entity
->toUrl('collection'));
return $result;
}