Problem/Motivation

Link fields store HTML attributes in their options property. These attributes already reach a links prop and the link field formatter, but no source can send them to an attributes prop. This is needed for components with separate url and attributes props.

The field property source does not cover it: options is a map, which matches no prop type.

Proposed resolution

We could add a "Link attributes" source, one per link field, for the attributes prop type. It returns options['attributes'] of the field item. This is the core link field contract.

A generic source for every map property would not make sense for attributes.

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

just_like_good_vibes created an issue. See original summary.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » pdureau
Status: Active » Needs review
pdureau’s picture

Assigned: pdureau » just_like_good_vibes
Status: Needs review » Reviewed & tested by the community

The proposal is straigthforward: a new source plugin for:

  • attributes prop types
  • field item context (field_granularity:item requirement)
  • only if field type is a link and the property is "option"

Tested with https://www.drupal.org/project/link_attributes (is there another way to test this?) It works.

But, it is not "perfect": an additional plugin deriver and a mechanism specific to a field type. It is the kind of source plugins whcih will not survive a UI Patterns 3.0 update.

Good enough for now though, mergeable.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Reviewed & tested by the community » Fixed

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.