You are here

public function SearchViewRoute::getRoute in Google Search Appliance 8

Get route dynamically from system settings.

1 string reference to 'SearchViewRoute::getRoute'
google_appliance.routing.yml in ./google_appliance.routing.yml
google_appliance.routing.yml

File

src/Routing/SearchViewRoute.php, line 34

Class

SearchViewRoute
Class DynamicRoute.

Namespace

Drupal\google_appliance\Routing

Code

public function getRoute() {
  $gsaDisplaySettings = $this->settings
    ->get('display_settings');
  $drupalPath = $gsaDisplaySettings['drupal_path'];
  $title = $gsaDisplaySettings['search_title'];
  if ($drupalPath === NULL) {
    return NULL;
  }
  $routes[self::ROUTE_NAME] = new Route('/' . $drupalPath . '/{search_query}/{result_sort}', [
    '_title' => $title,
    '_controller' => '\\Drupal\\google_appliance\\Controller\\SearchViewController::get',
    'search_query' => '',
    'result_sort' => '',
  ], [
    '_permission' => 'access google appliance content',
  ]);
  return $routes;
}