You are here

public function SearchPageRepository::setDefaultSearchPage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 103
Contains \Drupal\search\SearchPageRepository.

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();
}