Problem/Motivation
Core's link widget doesn't provide a way for users to set attributes on links such as
- id
- class
- target
- rel
- accesskey
- aria-label
- title
But this is a common use case.
The
link attributes β
module provides this widget, as well as a plugin system to allow module-developers and themes to expose more attributes for possible inclusion.
The project has 30,000 installs on D8+
The project allows you to nominate the form element to use for each attribute via the plugin system (which is yaml based).
A module developer can expose a new data-attribute using this yaml:
data-foo-attribute:
title: 'Some attribute'
options:
foo: Foo
bar: Bar
type: select
The keys roughly map to the form API elements.
Having a plugin manager that has a list of known attributes also allows for Drupal to have knowledge of what attributes are in use on a site.
This could be useful in a filtering context
Proposed resolution
Adapt the link attributes module for core by bringing its functionality/features into the core link module.
Remaining tasks
User interface changes
API changes
A new plugin system for allowed attributes
A new widget for link items
Data model changes
None, Link attributes makes use of the fact that core's link field has an options property, but just no way to set values in it.