Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295308

NodeRouteProvider should extend DefaultHtmlRouteProvider

$
0
0

Problem/Motivation

NodeRouteProvider does not extend DefaultHtmlRouteProvider, as a result NodeRouteProvider contains a lot of duplicate code and doesn't follow patterns of other entity types for some of its route names.

Proposed resolution

Make NodeRouteProvider extend DefaultHtmlRouteProvider.
Deprecate 'node.add' and 'node.add_page' routes

Remaining tasks

Review.
Commit

User interface changes

None.

API changes

The node.add and node.add_page routes are deprecated and replaced by entity.node.add_form and entity.node.add_page routes.

The node.add route is now an alias of entity.node.add_form.
The node.add_page route is now an alias of entity.node.add_page

This means most code dealing with the old routes will continue to work. However, if you have code specifically checking against the route name, this will no longer work. For example, if you have the following code:
\Drupal::routeMatch()->getRouteName() === 'node.add'
This will need to be updated to
\Drupal::routeMatch()->getRouteName() === 'entity.node.add_form'

If someone has a route provider that extends NodeRouteProvider and has e.g. a getCanonicalRoute() with different parameters than DefaultHtmlRouteProvider this could break. I think that is something we can get away with in a minor version but I think we can deal with that in a change record.

Data model changes

None.

Blocked on

On


Viewing all articles
Browse latest Browse all 295308

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>