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

  1. Write a patch
  2. Review
  3. 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

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
StatusFileSize
new2.81 KB
new3.81 KB

Attached patch applies bundle restrictions from a route to revisionable entities.

The last submitted patch, 2: 3317744-2-test-only.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 2: 3317744-2.patch, failed testing. View results

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new532 bytes
new2.81 KB
new3.83 KB

Attached patch fixes the return value for valid entities.

The last submitted patch, 5: 3317744-5-test-only.patch, failed testing. View results

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

This 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.

The last submitted patch, 5: 3317744-5-test-only.patch, failed testing. View results

The last submitted patch, 5: 3317744-5-test-only.patch, failed testing. View results

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!

  • catch committed 35ef8ef5 on 10.0.x
    Issue #3317744 by idebr, smustgrave: Bundle restrictions from a route do...

  • catch committed 25b8da7b on 10.1.x
    Issue #3317744 by idebr, smustgrave: Bundle restrictions from a route do...

  • catch committed 27c7e950 on 9.5.x
    Issue #3317744 by idebr, smustgrave: Bundle restrictions from a route do...
catch’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.