function SearchPageRepository::setDefaultSearchPage
Same name in other branches
- 9 core/modules/search/src/SearchPageRepository.php \Drupal\search\SearchPageRepository::setDefaultSearchPage()
- 8.9.x core/modules/search/src/SearchPageRepository.php \Drupal\search\SearchPageRepository::setDefaultSearchPage()
- 11.x core/modules/search/src/SearchPageRepository.php \Drupal\search\SearchPageRepository::setDefaultSearchPage()
File
-
core/
modules/ search/ src/ SearchPageRepository.php, line 98
Class
- SearchPageRepository
- Provides a repository for Search Page config entities.
Namespace
Drupal\searchCode
public function setDefaultSearchPage(SearchPageInterface $search_page) {
$this->configFactory
->getEditable('search.settings')
->set('default_page', $search_page->id())
->save();
$search_page->enable()
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.