Problem/Motivation

When rendering a Link field that uses the LinkIt widget, if we have URL substitution turned on (like for example, for Media changing the link to a download link instead of to the view page), when rendered, this substitution does not happen because Linkit needs a chance to alter the output like it does with its own formatter.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

A new formatter available for custom field subfield link types.

API changes

None

Data model changes

None

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:

Comments

dave reid created an issue. See original summary.

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

nickolaj’s picture

Status: Active » Needs review

Added Linkit formatters for both `link` and `uri` custom field subfield types. The formatters extend the existing Link/UriLink formatters and apply Linkit URL substitution (e.g., converting Media entity links to download URLs) using the configured Linkit profile, matching how Linkit's own formatter works for core Link fields. Also updated the config schema for the new `linkit_profile` formatter setting.

apmsooner’s picture

Status: Needs review » Needs work

Hi thanks for the work on this. One thing I believe is missing though is that we need to set those linkit attributes that are being queried for in the formatter in the LinkitWidget massageFormValue(). We don't store options in the UriType subfield so not sure what the LinkitUrlFormatter provides without them but assume it must provide some benefit. I havn't looked at linkit in a while so I'm probably just not fully educated on the benefit of its formatters over the regular ones ;)

  • apmsooner committed 9a6a4145 on 4.0.x authored by nickolaj
    Issue #3573610: Added Linkit formatters for both `link` and `uri` ...
    
apmsooner’s picture

Status: Needs work » Fixed

Thanks for the contribution @nickolaj! It's merged.
The widget stuff was already accounted for and this feature checked out fine for me. I made a few tweaks to reorder formatters and fix the fallback title from settings but not a direct issue for the basic request.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

apmsooner’s picture

Status: Fixed » Closed (fixed)