You are here

protected function DevelRouteSubscriber::getDevelSolrRoute in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 search_api_solr_devel/src/Routing/DevelRouteSubscriber.php \Drupal\search_api_solr_devel\Routing\DevelRouteSubscriber::getDevelSolrRoute()
  2. 4.x modules/search_api_solr_devel/src/Routing/DevelRouteSubscriber.php \Drupal\search_api_solr_devel\Routing\DevelRouteSubscriber::getDevelSolrRoute()

Gets the devel Solr route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

1 call to DevelRouteSubscriber::getDevelSolrRoute()
DevelRouteSubscriber::alterRoutes in modules/search_api_solr_devel/src/Routing/DevelRouteSubscriber.php
Alters existing routes for a specific collection.

File

modules/search_api_solr_devel/src/Routing/DevelRouteSubscriber.php, line 54

Class

DevelRouteSubscriber
Subscriber for Search Api Solr routes.

Namespace

Drupal\search_api_solr_devel\Routing

Code

protected function getDevelSolrRoute(EntityTypeInterface $entity_type) {
  if ($devel_solr = $entity_type
    ->getLinkTemplate('devel-solr')) {
    $entity_type_id = $entity_type
      ->id();
    $route = new Route($devel_solr);
    $route
      ->addDefaults([
      '_controller' => '\\Drupal\\search_api_solr_devel\\Controller\\DevelController::entitySolr',
      '_title' => 'Devel Solr',
    ])
      ->addRequirements([
      '_permission' => 'access devel information',
    ])
      ->setOption('_admin_route', TRUE)
      ->setOption('_devel_entity_type_id', $entity_type_id)
      ->setOption('parameters', [
      $entity_type_id => [
        'type' => 'entity:' . $entity_type_id,
      ],
    ]);
    return $route;
  }
}