Allow customize of Link field subfields title text in Link field Widget (LinkWidget)

Created on 20 June 2022, over 2 years ago
Updated 13 February 2023, almost 2 years ago

Problem/Motivation

Very often the "Link" field type is used to not display a regular html link, but to represent a Button with some action, or to store link to some resource (eg anchor, local file, some custom internal path).

And in that cases the hard-coded titles "URL" and "Link text" of the widget does not always suite, because link in that cases will not be displayed as link, but as some designed widget, and the action could be not the "jumping to the filled url".

But now we can't override the text of subfields titles, we can only add placeholders to the fields.

Steps to reproduce

Try to create a "field_action_button" Link field to represent a button, with "Name" as the title of the "url" subfield, and "Action" as the "title" subfield title.

It isn't possible to do without making a lot of hooks (two hooks per each entity bundle - for "add" and "edit" forms, plus additional hooks for "Inline Entity Form" subforms), or hooking the widget type, or creating a custom widget.

Proposed resolution

Allow setting the titles for the subfields in Link Widget settings.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

10.1

Component
Link 

Last updated about 7 hours ago

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    Seems like a fantastic idea!

    Tagging for tests to show this new feature in action.

  • Status changed to Needs review almost 2 years ago
  • 🇦🇲Armenia murz Yerevan, Armenia

    I've rebased the MR to 10.x and have extended the functional test for my changes, please review.

  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States smustgrave

    This looks like it's going to be a very neat feature!

    This will need an update hook I believe for existing sites. I imagine if users change a link field and make 0 changes they'll be notified of config changes.

Production build 0.71.5 2024