Filter linkit suggestions by active domain

Created on 10 February 2013, almost 12 years ago
Updated 31 August 2024, 5 months ago

I was running into a problem where the linkit module was suggesting nodes from all domains. It doesn't really make sense to generate relative links from one domain to another, so I suspect most people would want linkit to only suggest nodes for the current domain. This is easily accomplished using the following hook, which I would suggest should be added to the domain module. I just created a simple custom module in my case.

/**
 * Implementation of hook_query_linkit_node_autocomplete_alter
 */
function domain_query_linkit_node_autocomplete_alter(QueryAlterableInterface $query) {
  $query->innerJoin('domain_access', NULL, 'node.nid = domain_access.nid');
  $current_domain = domain_get_domain();
  $query->condition('domain_access.gid', $current_domain['domain_id']);
}
✨ Feature request
Status

Closed: won't fix

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cmoad

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024