use Symfony\Component\Routing\RouteCollection;
/**
* Provides routes for nodes.
*/
class NodeRouteProvider implements EntityRouteProviderInterface
{ /**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface
$entity_type) { $route_collection =
new RouteCollection();
$route =
(new Route('/node/{node}'
)) ->
addDefaults([ '_controller' => '\Drupal\node\Controller\NodeViewController::view',
'_title_callback' => '\Drupal\node\Controller\NodeViewController::title',
]) ->
setRequirement('node', '\d+'
) ->
setRequirement('_entity_access', 'node.view'
);
$route_collection->
add('entity.node.canonical',
$route);
$route =
(new Route('/node/{node}/delete'
)) ->
addDefaults([