Drupal is a registered trademark of Dries Buytaert

entity_attributes

10 sites Security covered
View on drupal.org

Entity Attributes module provides a UI for managing HTML attributes (id, class, data-*, etc.) across various entity types.

Features

Supported Entity Types

  • Nodes
  • Taxonomy Terms
  • Blocks
  • Menus
  • Content Menu Links
  • Static Menu Links
  • Paragraphs
  • ECK entities

Easy to add support for additional entity types.

Supported Attributes

Attributes are edited in YAML format. The module doesn't apply any restrictions on attribute names and values. Any valid attribute name and value entered in the attributes field will be converted to an attributes object and passed to the entity template.

Attribute Sets

Each entity type may support multiple attribute sets used in their templates:

  • attributes: Main container attributes (id, class, data-*)
  • title_attributes: Title-specific attributes
  • content_attributes: Content wrapper attributes
  • Plugin-specific attribute sets

Please check the module's README for more details about module features and usage.

The long story

Do you remember how often you need to highlight one link in a menu or add an anchor to a specific block on the page? Or when you need to add a class to an element on the site to apply some behavior?
Well, if you do, you are not alone.

Sometimes Drupal theming is difficult — you have to create special templates for elements that should stand out. Sometimes you need more semantic markup, sometimes you just need to add an ID to an element. These cases, and many others, are easily covered by HTML attributes. Despite Drupal having great support for attributes at the template level, there is a lack of UI for managing them at the content level and the glue to connect them to templates.
This is what this module is for.

What? Yet another module for managing classes? I already have five such modules installed.

Right, there are over a dozen good modules that solve these problems and do it well. But this raises another problem — you need to install multiple modules to solve similar issues for different entity types.

Similar modules are focused on handling classes or attributes for specific entity types, and sometimes that is absolutely okay. But if you need a consistent experience for managing attributes across most entity types, this module is quite unique.

Here is a list of the most popular attribute management modules that can be fully or partially replaced by Entity Attributes:

OK, makes sense, but is this module better?

I am not saying this module is the best one ever. It is fully built on Drupal Core APIs. It uses the right approaches for its functionality (stores data in the right place, manages operations the right way). It utilizes modern Drupal and PHP features. It is simple, flexible, and extensible. It is written based on many years of expertise in Drupal frontend and backend development. It is designed to solve one specific problem, and it solves it in the easiest and most consistent way. But it may just not suit your use case.

Activity

Total releases
3
First release
Jul 2025
Latest release
6 months ago
Release cadence
22 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
1.1.0 Stable Sep 1, 2025
1.0.1 Stable Jul 20, 2025
1.0.0 Stable Jul 20, 2025