comparison core/modules/node/src/Routing/RouteSubscriber.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\node\Routing;
4
5 use Drupal\Core\Routing\RouteSubscriberBase;
6 use Symfony\Component\Routing\RouteCollection;
7
8 /**
9 * Listens to the dynamic route events.
10 */
11 class RouteSubscriber extends RouteSubscriberBase {
12
13 /**
14 * {@inheritdoc}
15 */
16 protected function alterRoutes(RouteCollection $collection) {
17 // As nodes are the primary type of content, the node listing should be
18 // easily available. In order to do that, override admin/content to show
19 // a node listing instead of the path's child links.
20 $route = $collection->get('system.admin_content');
21 if ($route) {
22 $route->setDefaults([
23 '_title' => 'Content',
24 '_entity_list' => 'node',
25 ]);
26 $route->setRequirements([
27 '_permission' => 'access content overview',
28 ]);
29 }
30 }
31
32 }