Fixed
Project:
Linkit
Version:
7.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 May 2026 at 04:08 UTC
Updated:
13 May 2026 at 14:49 UTC
Jump to comment: Most recent, Most recent file
Linkit widget, when setting data-entity-substitution hardcode the substitution based on the entity type
https://git.drupalcode.org/project/linkit/-/blob/7.x/src/Plugin/Field/Fi...
The bug is not visible when searching for an entity from node form because the value get updated by JS using the proper substitution defined in config.
Linkit widget must load the substitution as by profile configuration, Hardcoded solution can be used as fallback
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | linkit--linkit-widget-has-hardcoded-substitution-3589257-2.patch | 1.64 KB | marco.pagliarulo |
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
Comment #3
marco.pagliarulo commentedPatch for
Comment #4
mark_fullmerUsing the Linkit Profile configuration matchers' substitution_type, if present, makes sense. I just have a small optimization suggestion for the code. Can we avoid multiple instances of
$entity->getEntityTypeId() === 'file' ? 'file' : 'canonical';? I think the code would execute the same if we just move$substitution_type = $entity->getEntityTypeId() === 'file' ? 'file' : 'canonical';aboveif ($matcher) {, then remove the else fallback.Comment #5
marco.pagliarulo commented@mark_fullmer thanks for the reply. I refactored the code as you suggested moving
above.
Comment #7
mark_fullmerThanks for the refactoring! This looks good. Merging!