I have a formatted text field on a content type that I'm using as the body of an email. If I load the node and print out the field I get:

>>> $n->field_thankyou_email_body->getValue()
=> [
       "value" => "<b>Thanks!!</b>",
       "format" => "subscriber_text_lb",

The array is missing the "processed" value, how do I get that? Or alternatively how do I manually run the value through the text format?

1 Answer 1


A field property is accessed like an object property:


As a side note, use this only for cases like this which are outside of the page render context. The preferable way is to render the text field in a render array to preserve attached metadata. See How to safely render node body on a custom variable?

  • oh so even though the debug doesn't show it, the property is accessible, thanks.
    – Lambic
    Commented Jul 25, 2022 at 15:32
  • Yes, this is because it is a computed property. Like entity of a reference field or date of a datetime field. See drupal.stackexchange.com/a/252341/47547
    – 4uk4
    Commented Jul 25, 2022 at 15:38
  • I'm getting object unless I typecast as below, (string) $entity->get('field_formatted_text')->processed;
    – Sivaji
    Commented Jul 31, 2023 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.