SearchController::performOperation

public SearchController::performOperation(SearchPageInterface $search_page, $op)

Performs an operation on the search page entity.

Parameters

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

string $op: The operation to perform, usually 'enable' or 'disable'.

Return value

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

File

core/modules/search/src/Controller/SearchController.php, line 206

Class

SearchController
Route controller for search.

Namespace

Drupal\search\Controller

Code

public function performOperation(SearchPageInterface $search_page, $op) {
  $search_page->$op()->save();

  if ($op == 'enable') {
    drupal_set_message($this->t('The %label search page has been enabled.', array('%label' => $search_page->label())));
  }
  elseif ($op == 'disable') {
    drupal_set_message($this->t('The %label search page has been disabled.', array('%label' => $search_page->label())));
  }

  $url = $search_page->urlInfo('collection');
  return $this->redirect($url->getRouteName(), $url->getRouteParameters(), $url->getOptions());
}
doc_Drupal
2016-10-29 09:40:14
Comments
Leave a Comment

Please login to continue.