function NodeRouteProvider::getRoutes

Overrides DefaultHtmlRouteProvider::getRoutes

File

core/modules/node/src/Entity/NodeRouteProvider.php, line 18

Class

NodeRouteProvider
Provides routes for nodes.

Namespace

Drupal\node\Entity

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $routes = parent::getRoutes($entity_type);
  // Rename the entity.node.add_form and entity.node.add_page routes to keep
  // BC.
  // @todo remove this and use an alias instead when https://www.drupal.org/project/drupal/issues/3506653 is done.
  $addPageRoute = $routes->get('entity.node.add_page');
  $routes->remove('entity.node.add_page');
  $routes->add('node.add_page', $addPageRoute);
  $addFormRoute = $routes->get('entity.node.add_form');
  $routes->remove('entity.node.add_form');
  $routes->add('node.add', $addFormRoute);
  return $routes;
}

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