public function SearchPageRepository::setDefaultSearchPage in Drupal 8
Same name and namespace in other branches
- 9 core/modules/search/src/SearchPageRepository.php \Drupal\search\SearchPageRepository::setDefaultSearchPage()
Sets a given search page as the default.
Parameters
\Drupal\search\SearchPageInterface $search_page: The search page entity.
Return value
static
Overrides SearchPageRepositoryInterface::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();
}