You are here

public function PathPluginBase::collectRoutes in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::collectRoutes()
  2. 10 core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::collectRoutes()

Adds the route entry of a view to the collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: A collection of routes that should be registered for this resource.

Overrides DisplayRouterInterface::collectRoutes

1 call to PathPluginBase::collectRoutes()
RestExport::collectRoutes in core/modules/rest/src/Plugin/views/display/RestExport.php
Adds the route entry of a view to the collection.
1 method overrides PathPluginBase::collectRoutes()
RestExport::collectRoutes in core/modules/rest/src/Plugin/views/display/RestExport.php
Adds the route entry of a view to the collection.

File

core/modules/views/src/Plugin/views/display/PathPluginBase.php, line 216

Class

PathPluginBase
The base display plugin for path/callbacks. This is used for pages and feeds.

Namespace

Drupal\views\Plugin\views\display

Code

public function collectRoutes(RouteCollection $collection) {
  $view_id = $this->view->storage
    ->id();
  $display_id = $this->display['id'];
  $route = $this
    ->getRoute($view_id, $display_id);
  if (!($route_name = $this
    ->getOption('route_name'))) {
    $route_name = "view.{$view_id}.{$display_id}";
  }
  $collection
    ->add($route_name, $route);
  return [
    "{$view_id}.{$display_id}" => $route_name,
  ];
}