SearchPageRepository::setDefaultSearchPage

public SearchPageRepository::setDefaultSearchPage(SearchPageInterface $search_page)

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\search

Code

public function setDefaultSearchPage(SearchPageInterface $search_page) {
  $this->configFactory->getEditable('search.settings')->set('default_page', $search_page->id())->save();
  $search_page->enable()->save();
}
doc_Drupal
2016-10-29 09:40:45
Comments
Leave a Comment

Please login to continue.