You are here

class SearchApiFederatedSolrRoutes 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
  2. 8.2 src/Routing/SearchApiFederatedSolrRoutes.php \Drupal\search_api_federated_solr\Routing\SearchApiFederatedSolrRoutes
  3. 4.x src/Routing/SearchApiFederatedSolrRoutes.php \Drupal\search_api_federated_solr\Routing\SearchApiFederatedSolrRoutes

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

Hierarchy

Expanded class hierarchy of SearchApiFederatedSolrRoutes

File

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

Namespace

Drupal\search_api_federated_solr\Routing
View source
class SearchApiFederatedSolrRoutes implements ContainerInjectionInterface {

  /**
   * The entity manager service.
   *
   * @var \Drupal\Core\Entity\EntityManagerInterface
   */
  protected $entityManager;

  /**
   * The language manager service.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface
   */
  protected $languageManager;

  /**
   * Constructs a new SearchApiRoutes object.
   *
   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
   *   The entity manager service.
   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager service.
   */
  public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) {
    $this->entityManager = $entity_manager;
    $this->languageManager = $language_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('entity.manager'), $container
      ->get('language_manager'));
  }

  /**
   * Returns an array of route objects.
   *
   * @return \Symfony\Component\Routing\Route[]
   *   An array of route objects.
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SearchApiFederatedSolrRoutes::$entityManager protected property The entity manager service.
SearchApiFederatedSolrRoutes::$languageManager protected property The language manager service.
SearchApiFederatedSolrRoutes::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
SearchApiFederatedSolrRoutes::routes public function Returns an array of route objects.
SearchApiFederatedSolrRoutes::__construct public function Constructs a new SearchApiRoutes object.