public function RouteSubscriber::routes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/EventSubscriber/RouteSubscriber.php \Drupal\views\EventSubscriber\RouteSubscriber::routes()
Returns a set of route objects.
Return value
\Symfony\Component\Routing\RouteCollection A route collection.
File
- core/
modules/ views/ src/ EventSubscriber/ RouteSubscriber.php, line 116 - Contains \Drupal\views\EventSubscriber\RouteSubscriber.
Class
- RouteSubscriber
- Builds up the routes of all views.
Namespace
Drupal\views\EventSubscriberCode
public function routes() {
$collection = new RouteCollection();
foreach ($this
->getViewsDisplayIDsWithRoute() as $pair) {
list($view_id, $display_id) = explode('.', $pair);
$view = $this->viewStorage
->load($view_id);
// @todo This should have an executable factory injected.
if (($view = $view
->getExecutable()) && $view instanceof ViewExecutable) {
if ($view
->setDisplay($display_id) && ($display = $view->displayHandlers
->get($display_id))) {
if ($display instanceof DisplayRouterInterface) {
$this->viewRouteNames += (array) $display
->collectRoutes($collection);
}
}
$view
->destroy();
}
}
$this->state
->set('views.view_route_names', $this->viewRouteNames);
return $collection;
}