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¶
- Go to Manage display of the bundle, for example
/admin/structure/types/manage/article/display. - Pick Tagify as the format of an entity reference field.
- 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 labelaccess) 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.twigtemplate, which themes can override.