This module adds data attributes to entity reference revisions, providing context like whether an entity is the first or last in a list, its position (odd/even), and its relationship to adjacent entities. These attributes are useful for theming and determining an entity's placement within a page context.
This field formatter adds contextual data attributes to entity reference revisions, useful specifically for determining how an element is positioned within a page and when theming a set of entities in the context of a list.
It offers the following:
data-entity-context-first - The first entity in the field
data-entity-context-last - The last entity in the field
data-entity-context-prev="{entity-bundle}" - The bundle of the previous entity
data-entity-context-next="{entity-bundle}" - The bundle of the next entity
data-entity-context-group="{entity-bundle-group-number}" - An increment of groups (where a group is a set of entities with the same bundle
data-entity-context-odd - An odd delta entity in the field list
data-entity-context-even - An even delta entity in the field list