Custom link attributes for 'link' sub-fields
Last updated on
21 May 2026
Here are instructions on how to add/remove/modify the available link attributes for 'link' sub-fields.
- Copy the custom_field.custom_field_link_attributes.yml file to the root of your own custom module.
- Rename the prefix of the file to the machine name of your module. e.g. my_module.custom_field_link_attributes.yml
- Add/Remove/Modify attributes.
- Clear cache.
Here are a few examples:
Add a new data type attribute as a checkbox:
data-download-only:
title: Download only
type: checkboxModify the existing class attribute to be checkboxes of limited options:
class:
title: Class
description: Select one or more classes from the available options.
type: checkboxes
options:
foo: Foo class
bar: Bar classHelp improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion