Skip to content

Tagify formatter

The Tagify formatter (tagify_entity_reference_formatter) displays the entities referenced by an entity reference field as tags, with the same look as the widget. It renders the markup on the server and loads only the Tagify stylesheet, not the JavaScript.

Enable it

  1. Go to Manage display of the bundle, for example /admin/structure/types/manage/article/display.
  2. Pick Tagify as the format of an entity reference field.
  3. Adjust the settings and save.

Settings

Setting Default Description
Link label to the referenced entity on Wraps each label in a link to the entity.
Include entity id off Adds the entity ID to each tag.
Include info label off Shows a second value inside each tag. See Info label.
Info label content empty Token template for the info label.

Notes

  • Entities whose label the visitor cannot view (view label access) are skipped.
  • Token values are escaped, so content cannot inject image or SVG markup into a tag. A value that is an image URL still renders as an image.
  • Modules implementing hook_tagify_autocomplete_match_alter() change the formatter's tags the same way they change the widget's, so a tag looks the same in the form and on the page.
  • With the library loaded from the CDN, every visitor of a page using this formatter requests the Tagify stylesheet from cdnjs. See Installation to serve it locally.
  • The markup comes from the tagify-formatter.html.twig template, which themes can override.