Problem/Motivation
#3155568: Filter by bundle in EntityConverter route param converter introduced bundle specific routes. However, this check does not work for revisionable entities such as node.
Steps to reproduce
Install Drupal with the Standard profile and implement the following route:
entity.node.article_only:
path: 'node/{node}/article-only'
defaults:
_entity_form: 'node.default'
requirements:
_entity_access: 'node.update'
options:
parameters:
node:
type: entity:node
bundle:
- article
This route will also work for node/{node}/article-only for Basic page nodes.
Proposed resolution
Apply bundle restrictions from a route to revisionable entities.
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
Bundle restrictions from a route now apply to revisionable entities.
Data model changes
None.
Release notes snippet
Bundle restrictions from a route now apply to revisionable entities.
Comments
Comment #2
idebr commentedAttached patch applies bundle restrictions from a route to revisionable entities.
Comment #5
idebr commentedAttached patch fixes the return value for valid entities.
Comment #7
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
Confirmed the issue following the steps in the issue summary.
Tested on Drupal 10.1 with a standard install
Applying the patch I was no longer able to use the route for basic pages.
Test coverage proves this.
Looks good.
Comment #10
catchCommitted/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!
Comment #14
catch