function SearchPageAddForm::save
Same name in other branches
- 8.9.x core/modules/search/src/Form/SearchPageAddForm.php \Drupal\search\Form\SearchPageAddForm::save()
- 10 core/modules/search/src/Form/SearchPageAddForm.php \Drupal\search\Form\SearchPageAddForm::save()
- 11.x core/modules/search/src/Form/SearchPageAddForm.php \Drupal\search\Form\SearchPageAddForm::save()
Overrides SearchPageFormBase::save
File
-
core/
modules/ search/ src/ Form/ SearchPageAddForm.php, line 36
Class
- SearchPageAddForm
- Provides a form for adding a search page.
Namespace
Drupal\search\FormCode
public function save(array $form, FormStateInterface $form_state) {
// If there is no default search page, make the added search the default.
if (!$this->searchPageRepository
->getDefaultSearchPage()) {
$this->searchPageRepository
->setDefaultSearchPage($this->entity);
}
parent::save($form, $form_state);
$this->messenger()
->addStatus($this->t('The %label search page has been added.', [
'%label' => $this->entity
->label(),
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.