public 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 111
Class
- RouteSubscriber
- Builds up the routes of all views.
Namespace
Drupal\views\EventSubscriber
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 ; } |
Please login to continue.