I am trying to get data from a text_long type field using EntityMetadataWrapper, and from what I'm seeing on the interwebs, I should be using something like this:




However, if I use the first one, I get an array with format and value keys, but if I try the latter, I get an Call to a member function value() on null` error.

Do I have to use $wrapper->{$field}->value(); and manually get the value from the array? Or is there a more direct method? I've looked through the class, I don't see another method that gets the value data.

1 Answer 1


Since the long text field is an array in the entity Metadata wrapper (due to fact that long text fields can have an input format applied to them), you should decode the text.

  1. See the Drupal.org entity Metadata documentation and search for the example $wrapper->body->value->value(array('decode' => TRUE));

  2. Also, check out this similar post about handling the formatting of long text fields when extracting with entity Metadata wrappers

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.