Problem/Motivation

When using Linkit in a WYSIWYG text editor, you can only see contents assigned to the current domain.

It would be interesting to be able to see contents from other domains assigned to the current user.

Proposed resolution

Extend default Linkit NodeMatcher to add temporary domain grants before doing the selection query.

Related domain issue: #3562696: Allow linking to nodes in other domains

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:

Comments

mably created an issue. See original summary.

lincoln-batsirayi’s picture

Status: Active » Reviewed & tested by the community

I’ve tested this and can confirm that it's working as expected, when the newly created "Assigned Domains Content" matcher is added the user is now able to search for content from all domains.

General note, I don’t know if it's worth adding a disclaimer somewhere that this matcher should replace the default matcher that already exists or not because initially i kept my original one and i was seeing duplicated content because of it, but maybe people can work it out?

Also this also works really work with domain_source because then you can ensure that the outputted link goes to the correct domain source, without the module this may result in a lot of dead links

mably’s picture

The following text was added to the configuration documentation:

Important: Remove any other Node/content matchers from this profile (e.g., Linkit’s default Node matcher). If multiple Node matchers are enabled, the same content can appear multiple times in the suggestions.

And this will be added to the Domain Access documentation:

Cross‑domain links and canonical domain (important)

When editors select and link to content that is assigned to a different domain than the currently active one, the generated link can point to a path that does not resolve on the current domain. This may produce dead links if the linked content’s canonical/source domain is not defined.

- Recommended: Enable and configure the Domain Source module so each node has a defined source domain. This ensures canonical URLs resolve on the appropriate domain and avoids broken links when referencing content across domains.
- Without a defined source domain, nodes that only exist on other domains might not be reachable from the current domain’s hostname, even if they appear in the selection list.

mably’s picture

May be we should "hide" this feature behind a custom permission?

Something like "Allow referencing content on all assigned domains"?

What do you think?

mably’s picture

Feature now requires the new "Allow referencing content on all assigned domains" dedicated permission.

mably’s picture

Hi @lincoln-batsirayi, can you validate that this MR still works after removing the dependency with the now-closed related Domain issue?

mably’s picture

Status: Reviewed & tested by the community » Needs review

I'll merge it as soon as I get a RTBC.

lincoln-batsirayi’s picture

Status: Needs review » Reviewed & tested by the community

I’ve tested this and can confirm that the new permission is functioning as expected (if the user is assigned to both domains and does not have the permission they can only search for content items in the same domain, having the permission allows them to search for content in all domains) and the MR update has had no adverse impact on the functionality which still works.

mably’s picture

Thanks for the review @lincoln-batsirayi!

Merging.

mably’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

New related documentation page generated using MkDocs:

https://domain-extras-bc969b.pages.drupalcode.org/domain_access_linkit/

Status: Fixed » Closed (fixed)

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