You are here

class SearchViewRoute in Google Search Appliance 8

Class DynamicRoute.

Hierarchy

Expanded class hierarchy of SearchViewRoute

7 files declare their use of SearchViewRoute
google_appliance.module in ./google_appliance.module
Google Appliance module file.
ResultSet.php in src/SearchResults/ResultSet.php
SearchBlockTest.php in tests/src/Functional/SearchBlockTest.php
SearchForm.php in src/Form/SearchForm.php
SearchPageTest.php in tests/src/Functional/SearchPageTest.php

... See full list

File

src/Routing/SearchViewRoute.php, line 11

Namespace

Drupal\google_appliance\Routing
View source
class SearchViewRoute {
  const ROUTE_NAME = 'google_appliance.search_view';

  /**
   * Module settings.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected $settings;

  /**
   * SearchViewRoute constructor.
   *
   * @todo: Proper D.I.
   */
  public function __construct() {
    $this->settings = Drupal::configFactory()
      ->get('google_appliance.settings');
  }

  /**
   * Get route dynamically from system settings.
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SearchViewRoute::$settings protected property Module settings.
SearchViewRoute::getRoute public function Get route dynamically from system settings.
SearchViewRoute::ROUTE_NAME constant
SearchViewRoute::__construct public function SearchViewRoute constructor.