🇺🇦 |
This module is maintained by Ukrainian developers. Please consider supporting Ukraine in a fight for their freedom and safety of Europe. |
The Custom Formatters module allows users to easily create custom Field Formatters through an admin UI without writing a custom module. Custom Formatters are exported as Drupal configuration entities.
Â
Requirements:
- Drupal 10 or 11
- PHP 8.2+
Â
Features:
- Pluggable formatter engines:
-
Formatter Preset
Build formatters from existing field formatters with preset settings. -
HTML + Tokens
A HTML based editor with Token support, including a Token tree browser when the Token module is installed. -
PHP
A PHP based editor with support for multiple fields and multiple values. -
Twig
A Twig based editor with support for multiple fields and multiple values.
-
Formatter Preset
- Per-instance formatter settings via Field UI — add configurable fields to a formatter via its "Manage fields" tab; settings appear inline in "Manage display" and are passed to engine templates as both rendered strings and raw unformatted values:
- PHP:
$settings['field_name'](rendered),$raw_settings['field_name'](raw). - Twig:
{{ settings.field_name }}(rendered),{{ raw_settings.field_name }}(raw). - HTML+Token:
[formatter_setting:field_name](rendered),[formatter_setting:field_name:raw](raw).
- PHP:
- Supports all fieldable entities, including but not limited to:
- Drupal core — Comment, Node, Taxonomy term, User, and Media entities.
- Exportable as Drupal configuration entities.
- Live preview using real entities, with Devel Generate integration for generating sample entities when no real entities exist with the target field type.
- Integrates with:
-
Contextual links (Drupal core)
Adds a hover link for quick editing of Custom Formatters. -
Token
Adds the Token tree browser to the HTML + Tokens engine with automatic entity reference token support. -
CodeMirror Editor (optional)
Provides syntax-highlighted code editing for the PHP, HTML+Token, and Twig engines, with context-aware autocomplete. -
Devel Generate (optional)
Generates sample entities with dummy field data for the live preview system.
-
Contextual links (Drupal core)
Â
Recommended Modules:
- Token — Token tree browser for the HTML + Tokens engine.
- Field tokens — Formatted field and field property tokens for the HTML + Token engine.
- CodeMirror Editor — Syntax-highlighted code editing with context-aware autocomplete.
- Devel — Devel Generate sub-module for generating sample preview entities.
Â
Configuration:
Read the manual at: https://www.drupal.org/node/2514412
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Content display, Developer tools, Site structure
- Ecosystem: YMCA Website Services (former Open Y) Community Edition
3,017 sites report using this module
- Created by deciphered on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.
Releases
4.1.0-beta3
released 7 June 2026
Works with Drupal: ^8.8 || ^9 || ^10 || ^11
The third beta release of Custom Formatters 4.1.0 for Drupal 10 and 11, adding per-formatter configurable fields via Field UI, raw settings access across all engine plugins, and context-aware CodeMirror autocomplete hints.
Install:
Development version: 4.1.x-dev updated 7 Jun 2026 at 09:07 UTC

