function RouteSubscriber::alterRoutes

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([
      '_title' => 'Content',
      '_entity_list' => 'node',
    ]);
    $route->setRequirements([
      '_permission' => 'access content overview',
    ]);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.