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.

  1. Copy the custom_field.custom_field_link_attributes.yml file to the root of your own custom module.
  2. Rename the prefix of the file to the machine name of your module. e.g. my_module.custom_field_link_attributes.yml
  3. Add/Remove/Modify attributes.
  4. Clear cache.

Here are a few examples:

Add a new data type attribute as a checkbox:

data-download-only:
  title: Download only
  type: checkbox

 Modify 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 class

Help improve this page

Page status: No known problems

You can: