Reference to an untranslated page causes 404 of parent page

Created on 19 April 2023, about 1 year ago
Updated 4 December 2023, 7 months ago

Problem/Motivation

When creating a content type with an entity reference field, it's possible that that field links to a page that's untranslated.

With the current setup of the module, the parent page that links to the untranslated entity will also throw a 404, even though it's translated.

Steps to reproduce

* Create a content type with a reference field
* Create a page in a certain language
* Create another page in another language, and add a reference to the earlier created page
* When viewing this page, you'll also receive a 404.

Proposed resolution

Add extra validation in the entity_view hook to see if the current page matches the entity before giving the 404

Remaining tasks

TBD: Decide what needs to happen with the link to the node, if it still needs to be shown or not.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium brentg Ghent

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @brentg
  • @brentg opened merge request.
  • Status changed to Needs review 9 months ago
  • πŸ‡§πŸ‡ͺBelgium al0a

    Created a patch, with another approach: We shouldn't check on the view mode, since this can be anything. It also supports multiple entities.

  • πŸ‡§πŸ‡ͺBelgium daften

    I tried to reproduce this problem using the steps from the description, but couldn't do that. Maybe the link being shown is already prevented by another contrib module on the project I tested it on or the behaviour changed in Drupal core.

    The patch looks good, but without a means to reproduce it, I can't merge it in.

Production build 0.69.0 2024