You are here

public function SearchApiFederatedSolrRoutes::routes in Search API Federated Solr 8

Same name and namespace in other branches
  1. 8.3 src/Routing/SearchApiFederatedSolrRoutes.php \Drupal\search_api_federated_solr\Routing\SearchApiFederatedSolrRoutes::routes()
  2. 8.2 src/Routing/SearchApiFederatedSolrRoutes.php \Drupal\search_api_federated_solr\Routing\SearchApiFederatedSolrRoutes::routes()
  3. 4.x src/Routing/SearchApiFederatedSolrRoutes.php \Drupal\search_api_federated_solr\Routing\SearchApiFederatedSolrRoutes::routes()

Returns an array of route objects.

Return value

\Symfony\Component\Routing\Route[] An array of route objects.

1 string reference to 'SearchApiFederatedSolrRoutes::routes'
search_api_federated_solr.routing.yml in ./search_api_federated_solr.routing.yml
search_api_federated_solr.routing.yml

File

src/Routing/SearchApiFederatedSolrRoutes.php, line 64
Contains Drupal\search_api_federated_solr\Routing\SearchApiFederatedSolrRoutes.

Class

SearchApiFederatedSolrRoutes
Defines a route subscriber to register a url for serving search pages.

Namespace

Drupal\search_api_federated_solr\Routing

Code

public function routes() {
  $routes = [];
  $app_config = \Drupal::config('search_api_federated_solr.search_app.settings');
  $path = $app_config
    ->get('path') ?: '/search-app';
  $args = [
    '_controller' => 'Drupal\\search_api_federated_solr\\Controller\\SearchController::searchPage',
    '_title' => 'Search',
  ];
  $routes['search_api_federated_solr.search'] = new Route($path, $args, [
    '_permission' => 'use federated search',
  ]);
  return $routes;
}