Problem/Motivation
Since #2712951: Linkit for Link field, Linkit provides a link formatter, which is a subclass of core's LinkFormatter.
It inherits 2 settings, Add rel="nofollow" to links (rel) and Open link in new window (rel), which can be set via checkboxes. But when passing an internal link to a link field, these settings are ignored.
Steps to reproduce
Configure a link field to use Linkit's formatter. Edit a node, select an internal page as target. Check at least one of the settings mentioned above. Save the node. View the page and inspect the link field => the link contains neither the rel nor the target attribute.
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3350477-rel-target-test-coverage_3.patch | 1.26 KB | mark_fullmer |
| #2 | 3350477-linkitformatter-ignores-settings-2.patch | 1.38 KB | mrshowerman |
Issue fork linkit-3350477
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
Comment #2
mrshowermanHere's a first patch that brings back the attributes.
Could use some help with a test though.
Comment #3
mark_fullmerI'm not sure I'm able to reproduce the problem described in the 6.0.x branch. I've attached a patch that includes test coverage that demonstrates the the
relandtargetvalues are reflected from the Linkit Formatter settings.Comment #4
mrshowermanI had another look and it seems the issue isn't in Linkit, but related to the patch from #2885351: Query string duplications, where the link item's #options is being reset to an empty array, in order to avoid duplicate query string parameters.
Sorry for the noise; I'll take a closer look at #2885351, maybe there's a better approach than the current one.
Not sure if this is the right status; maybe the test is still useful for detecting similar issues in the future.
Comment #5
mark_fullmerRe-opening and updating the title to indicate that we can add test coverage to demonstrate this works as designed (and to flag a failure in #2885351: Query string duplications.
Comment #6
mmarler commentedComment #7
mmarler commentedLooks good.
Comment #8
mmarler commentedComment #11
mark_fullmerComment #13
mark_fullmerWith #2885351: Query string duplications added in Drupal 10.2.3, this is now a problem as it was originally reported by mrshowerman. The previously added test coverage IS now failing on Drupal 10.2.3. The original proposed patch resolves the issue.
Comment #16
mark_fullmer