Linkit field widget - inconsistencies in multilingual content handling

Created on 28 March 2023, about 1 year ago
Updated 16 May 2024, about 1 month ago

Problem/Motivation

When linking to multilingual content from a link field using the Linkit widget there appear to be some unexpected conversions of the stored uri and href values happening when resaving content which changes the link destination.

Steps to reproduce

  • Install Drupal 9.5.7, Linkit 6.0.x-dev, enable content translation and set up 2 languages e.g. English (site default) and Finnish
  • Enable translation for the Article content type, add a link field set to use the Linkit widget
  • Create "Article A" - with FI as the default language and add EN translation titled "[FI] Article A"
  • Create "Article B" - with EN as the default language add a link to Article A and save.

When the target node does not have a path alias everything works well for the most part with the exception of reopening the "Article B" edit form shows conflicting information in the widget. Is it intentional that the URL value points to the default language of the target node? (the rendered link still points to the EN version of "Article A" as expected though")

However when path aliases are in use things get a bit more problematic.
After the initial save everything is fine - rendered link points to the EN path alias of "Article A".

Field contents from devel:

Reopening the edit form of "Article B" shows a similar situation as before - the URL value now points to the FI alias of the target node. Additionally the Linkit matcher reports "No content suggestions found. This URL will be used as is"

Resaving this node causes the stored values to change to:

The rendered link now points to the FI path alias of the target node. Also if the path alias of the target node changes this link will stop functioning altogether.

I went through a few of the other issues related to multilingual content links but they appear to be either related to the 5.x version or dealing mainly with the functionality of the CKEditor plugin so I think this deserves a separate issue. I do not have a solution in mind at the moment just wanted to get a report on this issue out there so we can gather some opinions on how this should be approached.

πŸ› Bug report
Status

Needs review

Version

7.0

Component

Code

Created by

πŸ‡±πŸ‡»Latvia artis.bajars

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

Comments & Activities

Production build 0.69.0 2024