RouteSubscriber::alterRoutes

protected RouteSubscriber::alterRoutes(RouteCollection $collection)

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

core/modules/node/src/Routing/RouteSubscriber.php, line 16

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\node\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  // As nodes are the primary type of content, the node listing should be
  // easily available. In order to do that, override admin/content to show
  // a node listing instead of the path's child links.
  $route = $collection->get('system.admin_content');
  if ($route) {
    $route->setDefaults(array(
      '_title' => 'Content',
      '_entity_list' => 'node',
    ));
    $route->setRequirements(array(
      '_permission' => 'access content overview',
    ));
  }
}
doc_Drupal
2016-10-29 09:39:26
Comments
Leave a Comment

Please login to continue.