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.

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mrshowerman created an issue. See original summary.

mrshowerman’s picture

Version: 2.1.0 » 2.x-dev
Assigned: mrshowerman » Unassigned
Status: Active » Needs review
FileSize
805 bytes

This seems to fix it.

Status: Needs review » Needs work

The last submitted patch, 2: 3379989-widget-overrides-options-2.patch, failed testing. View results

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Status: Needs work » Needs review

Updated with conditional clause. Please review.

larowlan’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks, this is a great find.

Can we update the test coverage to ensure the broken behaviour (missing data-entity-uuid etc) works as expected?

Ruslan Piskarov’s picture

Thank you @sakthi_dev. Works well for me.