Module Description
Overview Link attributes widget provides an additional widget for the link field found in Drupal core.
The widget allows users to set attributes on their link.
In addition the module alters the default menu link content link field to use this widget, allowing menu links to have attributes too
Features Supported attributes include
* id
* class
* name
* target
* rel
* accesskey
* aria-label (since 8.x-1.3)
* title (since 8.x-1.7)
* Linkit support (since 2.1.0) - via a submodule
Should I use the 1.x or 2.x version? New installs should use the 2.x version. Existing sites on the 1.x version are encouraged to update to the 2.x stream. There are no breaking changes, but 2.x splits the automatic use of the widget for menu links into a submodule.
Installation and configuration overview
* Enable the module like normal
* If using the 1️⃣.x branch, It will immediately take effect on menu link content entities.
* If using the 2️⃣.x branch, enable the Link Attributes Menu Link Content sub module and It will immediately take effect on menu link content entities.
* For other link fields, edit the widget using 'Manage form display' and select the 'Link (with attributes)' widget
* Read the documentation for how to modify defaults and add custom attributes.
* Optionally enable the Linkit Attributes sub-module to make an additional Linkit (with Attributes) widget available.
Limitations Note that some menu links are provided by modules. These links do not have a link field, and cannot have attributes added. For example the 'Contact' link provided by the contact module in the footer menu. Only links that are added using menu link content entities have a link field.
For those, just disable the default and add your own using Menu Link Content
Known problems Please use the issue queue to search for any known issues or to add a new one.
Credits Link attributes was written by Lee Rowlands (@larowlan).
Tutorials
* Drupal modules the one percent did a screencast of this module in action (2 minutes long)
Similar modules Whilst these modules have a similar impact on menu links, they don't support the generic link field like Link Attributes does. Using Link attributes means you can leverage this functionality for link fields on any entity type, not just menu links.
* Menu attributes: https://www.drupal.org/project/menu_attributes
* Menu Link Attributes: https://www.drupal.org/project/menu_link_attributes
* Menu Item Extras: https://www.drupal.org/project/menu_item_extras
The widget allows users to set attributes on their link.
In addition the module alters the default menu link content link field to use this widget, allowing menu links to have attributes too
Features Supported attributes include
* id
* class
* name
* target
* rel
* accesskey
* aria-label (since 8.x-1.3)
* title (since 8.x-1.7)
* Linkit support (since 2.1.0) - via a submodule
Should I use the 1.x or 2.x version? New installs should use the 2.x version. Existing sites on the 1.x version are encouraged to update to the 2.x stream. There are no breaking changes, but 2.x splits the automatic use of the widget for menu links into a submodule.
Installation and configuration overview
* Enable the module like normal
* If using the 1️⃣.x branch, It will immediately take effect on menu link content entities.
* If using the 2️⃣.x branch, enable the Link Attributes Menu Link Content sub module and It will immediately take effect on menu link content entities.
* For other link fields, edit the widget using 'Manage form display' and select the 'Link (with attributes)' widget
* Read the documentation for how to modify defaults and add custom attributes.
* Optionally enable the Linkit Attributes sub-module to make an additional Linkit (with Attributes) widget available.
Limitations Note that some menu links are provided by modules. These links do not have a link field, and cannot have attributes added. For example the 'Contact' link provided by the contact module in the footer menu. Only links that are added using menu link content entities have a link field.
For those, just disable the default and add your own using Menu Link Content
Known problems Please use the issue queue to search for any known issues or to add a new one.
Credits Link attributes was written by Lee Rowlands (@larowlan).
Tutorials
* Drupal modules the one percent did a screencast of this module in action (2 minutes long)
Similar modules Whilst these modules have a similar impact on menu links, they don't support the generic link field like Link Attributes does. Using Link attributes means you can leverage this functionality for link fields on any entity type, not just menu links.
* Menu attributes: https://www.drupal.org/project/menu_attributes
* Menu Link Attributes: https://www.drupal.org/project/menu_link_attributes
* Menu Item Extras: https://www.drupal.org/project/menu_item_extras
Module Link
Project Usage
45881
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
The module aims to provide a widget for setting attributes on link fields in Drupal core, including menu links, supporting attributes like id, class, target, and more.
Data Name
link_attributes