05.03.2026 | Michael Ebert

How to output the processed value of a WYSIWYG text field

EntityFieldValue.php
$raw_value = $entity->my_text_field->value;
echo $raw_value;  // Outputs the raw data
EntityFieldProcessed.php
$processed_value = $entity->my_text_field->processed;
echo $processed_value;  // Outputs the processed and safe-to-display data

Issue:

You need to output the processed value of a WYSIWYG text field to the user.

Solution:

For text fields there is a nice property that gives you the processed value directly. Let's have a quick look at the differences:

 unprocessed (raw) outputprocessed output
Field property->value->processed
When to Use
  • when you need the original, unaltered data.
  • when you plan to apply custom processing or formatting.
  • for programmatic manipulation or calculations that require raw data.
  • When displaying the field value directly to users.
  • when you need a value that has been filtered or formatted according to site settings (e.g., text formats, HTML filtering).
  • to ensure consistency in how field data is presented across the site.

CAUTION: The field property 'processed' only exists on WYSIWYG textfields!