Problem/Motivation
The new Linkit (with attributes) widget is so useful, since it combines the features of this module and Linkit, thanks very much!
However, I noticed that when using this widget for linking to a media entity, the link is always rendered in the canonical form /media/[id], even when Linkit's substitution type is set to media
, which should result in a link to the media's source file.
Proposed resolution
I found out that the options data-entity-type
, data-entity-uuid
and data-entity-substitution
are missing. The reason seems to be the widget's massageFormValues()
method, which overrides that of Linkit's widget, where those options are copied from the attributes
key to options
.
So doing the same (or similar) in this widget's method should solve the issue.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3379989-widget-overrides-options-2.patch | 805 bytes | mrshowerman |
Issue fork link_attributes-3379989
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
mrshowermanThis seems to fix it.
Comment #6
sakthi_dev CreditAttribution: sakthi_dev at Specbee for Drupal India Association commentedUpdated with conditional clause. Please review.
Comment #7
larowlanThanks, this is a great find.
Can we update the test coverage to ensure the broken behaviour (missing data-entity-uuid etc) works as expected?
Comment #8
Ruslan PiskarovThank you @sakthi_dev. Works well for me.