How to output the processed value of a WYSIWYG text field
You need to output the processed value of a WYSIWYG text field to the user.
$raw_value = $entity->my_text_field->value;
echo $raw_value; // Outputs the raw data$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) output | processed output | |
|---|---|---|
| Field property | ->value | ->processed |
| When to Use |
|
|
CAUTION: The field property 'processed' only exists on WYSIWYG textfields!
Ihre Drupal-Website zukunftssicher machen
Wir prüfen Ihr System und zeigen, was Sie für AI, Wartung und Upgrades brauchen.