Module Description
Overview Entity Class Formatter is a very simple module which formats values of fields (of varying types) such that a class or attribute is placed on the parent entity of that field. The module can be used to apply classes/attributes on entities, allowing the class/attribute to act as a modifier which can be used by the theming layer.

Usage Follow these steps


* Add a text, list, entity reference or boolean field to any entity (Node, Paragraph, Block, etc).
* Set the display to "Entity Class" (on manage display admin page).
* Create matching CSS rules in your theme or map a Modifier using the Look module.

Optional configuration
* Prefix to be attached before each class/attribute.
* Suffix to be attached after each class/attribute.
* Attribute name to be used instead of class.
* Referenced entity field name to be used instead of label.

Supported field types This formatter can be applied to the following field types:


* Text
* List
* Entity Reference
* Boolean

Supported entity types This formatter works with all entity types.

Similar Modules The module is similar to two other modules, but differs in important ways.

The Classy Paragraphs module was intended to apply to Paragraphs only and is quite structured in the way classes are applied through a custom field type. The Entity Class Formatter module is more flexible in that it has been designed to apply to all entity types. It can also handle a variety of field types (text, select lists, entity references) and is able to adapt to the data at hand.

The Field Formatter CSS Class module also uses a field formatter approach to applying the class to the entity. It does have more complexity than this module because it deals with several layers of nesting. The Entity Class Formatter is very simple and only applies to the parent entity of the field.

Demo Video Drupal Modules: The One Percent —Entity Class Formatter (tutorial) from NonProfit.

GitHub Development is happening in our GitHub repository. The drupal.org issue queue is still used to coordinate development.

Project Usage
4139
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
Entity Class Formatter module aims to solve the issue of formatting field values by applying classes or attributes to the parent entity, allowing for easy theming modifications.
Data Name
entity_class_formatter

OPENAI CHATBOT

OPENAI CHATBOT

11:22:25
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.