You are here

public function SearchApiPageController::title in Search API Pages 8

Title callback.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

string $search_api_page_name: The search api page name.

string $keys: The search word.

Return value

string The page title.

File

src/Controller/SearchApiPageController.php, line 340

Class

SearchApiPageController
Defines a controller to serve search pages.

Namespace

Drupal\search_api_page\Controller

Code

public function title(Request $request, $search_api_page_name = NULL, $keys = '') {

  // Provide a default title if no search API page name is provided.
  if ($search_api_page_name === NULL) {
    return $this
      ->t('Search');
  }

  /* @var $search_api_page \Drupal\search_api_page\SearchApiPageInterface */
  $search_api_page = SearchApiPage::load($search_api_page_name);
  return $search_api_page
    ->label();
}