
In Drupal 10.2 versions, options are not set anymore on the link element in viewElements() of the LinkFormatter - see https://www.drupal.org/project/drupal/issues/2885351 and https://git.drupalcode.org/project/drupal/-/merge_requests/5333/diffs?co...
Also LinkitFormatter (I tested with linkit 6.1.3) overrides the url attributes option for linkit entity urls and these get lost (probably somewhere here $url = $this->getSubstitutedUrl($link_item)) which means they can't be set in the preRenderLink() method from the Link render element.
All of these combined contribute to the fact that link attributes are not set for linkit entity links.
Comment | File | Size | Author |
---|---|---|---|
#9 | 3441789-linkit-attributes_not_applied-9.patch | 1.19 KB | adinac |
Issue fork linkit-3441789
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:
- 3441789-link-attributes-are
changes, plain diff MR !51
Comments
Comment #2
larowlanDo you have any custom preprocessing?
Does this happen with a core theme?
Comment #3
larowlanPlease see #3423171: Link attributes not working after upgrading Drupal core from 10.2.2 to 10.2.3
Comment #4
adinac CreditAttribution: adinac as a volunteer commentedI have seen that issue and no, we don't have any custom preprocessing for links.
Comment #5
larowlanThis module does not provide a formatter or do anything for output, it only provides a widget for editing.
Is the value there when you edit? If so the issue is in the theme or somewhere else
Comment #6
adinac CreditAttribution: adinac as a volunteer commentedComment #7
adinac CreditAttribution: adinac as a volunteer commentedSince the attributes get lost in the LinkitFormatter viewElements() when the url is overwritten for entity links ($url = $this->getSubstitutedUrl($link_item)), I decided to move this issue to the linkit module.
Comment #8
adinac CreditAttribution: adinac as a volunteer commentedComment #9
adinac CreditAttribution: adinac as a volunteer commentedComment #10
mark_fullmerThanks for reporting this! Can you provide steps to reproduce? Ideally, we can use those to model new test coverage to ensure that attributes don't go missing again!
Comment #12
mark_fullmerI was aware of #2885351: Query string duplications and had commented on the implications for Linkit in https://www.drupal.org/project/drupal/issues/2885351#comment-15461298 . We' addressed the problem for the two attributes supported by the Linkit formatter with #3350477: Linkit for Link Field: "rel" and "target" settings are removed for internal links, but I follow your hypothesis that other atttributes could be lost during the call to
$url = $this->getSubstitutedUrl($link_item)
.Adding a merge request that replicates the logic from #9, which no longer applies to 6.1.x
Comment #14
mark_fullmer