Drupal is a registered trademark of Dries Buytaert
cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)!
RAW Fields Formatters

Provides raw field formatters for Drupal, designed to expose field values as structured data. Primarily intended for use with Single-Directory Components (SDC) and JSON rendering pipelines.

Overview

Each formatter outputs raw typed values (string, integer, boolean, float, array) instead of rendered HTML, making it straightforward to pass field data directly to SDC component props.

All formatters share two common settings:

  • Override default key with — Override the key used when the renderer collects field data.
  • Force as array — Always output a list, even when there is only one value.

Available formatters

Formatter Field types Extra settings Raw Boolean boolean — Raw Decimal decimal, float — Raw Formatted Text text, text_long, text_with_summary — Raw Geolocation Lat/Lng geolocation — Raw Icon ui_icon — Raw Image URL image Image style Raw Integer integer — Raw List Value list_integer, list_float, list_string — Raw Entity entity_reference View mode Raw Paragraph entity_reference_revisions View mode Raw String string, string_long, telephone — Raw URL link —

Optional dependencies

Some formatters require a contrib module to be useful:

Usage with RawRenderer

Use the raw_fields_formatters.renderer service to collect the rendered data into a plain PHP array:

$renderer = \Drupal::service('raw_fields_formatters.renderer');
$variables = ['elements' => $build];
$renderer->renderData($variables);
$data = $variables['data'];

Requirements

  • Drupal 10 or 11
  • PHP 8.1+

Installation

Install as any other Drupal module via Composer:

composer require drupal/raw_fields_formatters
drush en raw_fields_formatters

Maintainers

Activity

Total releases
3
First release
Apr 2026
Latest release
4 weeks ago
Release cadence
8 days
Stability
0% stable

Release Timeline

Releases

Version Type Release date
1.0.0-alpha2 Pre-release May 16, 2026
1.0.0-alpha1 Pre-release Apr 30, 2026
1.0.x-dev Dev Apr 30, 2026