Problem/Motivation

We have a website with 2 languages: English and Dutch. When creating links with the Linkit module, we are able to link to English pages when creating or editing English pages, and we are able to link to Dutch pages when creating or editing Dutch pages.
If a page doesn't have a translation, it's possible to link to that page, regardless of the language of the page you are creating / editing.
If a page does have a translation, Linkit will currently always match the language of the linked node with the language of the current node.

Now our client would like to be able to link to pages in a different language, also if there is a translation available.

Steps to reproduce

  • Have a multilingual website (ie. with Dutch and English as languages), with the Linkit module setup
  • Create a node with a translation
  • Create a node without a translation
  • Create a new node, and add a link to the first node (which has a translation), and add a link to the second node (which doesn't have a translation
  • If you now add a translation for the third node, and keep the links in there the same, you should see that on the Dutch version of the page, the first link links to the Dutch version of the first node. The second link will link to the second node, in the language it was created in. On the English version you should see the first link linking to the English version of the first node. The second link will link to the second node in the language it was created in.

Like this, it doesn't seem possible to link to a node in a different language, if that node has a translation in the current language.

Proposed resolution

I have created a patch which will allow for this.
Currently it does the following:

  • Adds a configuration setting to enable this functionality
  • When enabled, the suggestions in the EntityMatcher are expanded, so they contain suggestions for nodes in each available language
  • The url is rewritten, so the language stays preserved in the output

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork linkit-3241565

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Daluxz created an issue.