public function ConfigTestForm::save in Drupal 10
Same name and namespace in other branches
- 8 core/modules/config/tests/config_test/src/ConfigTestForm.php \Drupal\config_test\ConfigTestForm::save()
- 9 core/modules/config/tests/config_test/src/ConfigTestForm.php \Drupal\config_test\ConfigTestForm::save()
File
- core/
modules/ config/ tests/ config_test/ src/ ConfigTestForm.php, line 137
Class
- ConfigTestForm
- Form controller for the test config edit forms.
Namespace
Drupal\config_testCode
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = $entity
->save();
if ($status === SAVED_UPDATED) {
$this
->messenger()
->addStatus(new FormattableMarkup('%label configuration has been updated.', [
'%label' => $entity
->label(),
]));
}
else {
$this
->messenger()
->addStatus(new FormattableMarkup('%label configuration has been created.', [
'%label' => $entity
->label(),
]));
}
$form_state
->setRedirectUrl($this->entity
->toUrl('collection'));
}