You are here

public function SearchController::setAsDefault in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/search/src/Controller/SearchController.php \Drupal\search\Controller\SearchController::setAsDefault()

Sets the search page as the default.

Parameters

\Drupal\search\SearchPageInterface $search_page: The search page entity.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect to the search settings page.

1 string reference to 'SearchController::setAsDefault'
search.routing.yml in core/modules/search/search.routing.yml
core/modules/search/search.routing.yml

File

core/modules/search/src/Controller/SearchController.php, line 238
Contains \Drupal\search\Controller\SearchController.

Class

SearchController
Route controller for search.

Namespace

Drupal\search\Controller

Code

public function setAsDefault(SearchPageInterface $search_page) {

  // Set the default page to this search page.
  $this->searchPageRepository
    ->setDefaultSearchPage($search_page);
  drupal_set_message($this
    ->t('The default search page is now %label. Be sure to check the ordering of your search pages.', array(
    '%label' => $search_page
      ->label(),
  )));
  return $this
    ->redirect('entity.search_page.collection');
}