2

I'm using a EntityMetadataWrapper on a profile2 entity. One of the fields is a multi-value entity reference field to nodes. I want to simple get the node ids as an array, so I can do a quick in_array() to see if a value already exists.

I can't seem to find how to easily do this.

2

Should be as simple as:

$ids = $wrapper->field_foo->raw();

And if you want an array of entities instead:

$entities = $wrapper->field_foo->value();
  • Thanks! I'm trying to get my arms around entity wrappers. – vintorg Mar 17 '14 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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