1

Im new to drupal and im trying to perform this operation, can some one help me on how can i add a new value to an entity reference field that its been set to hold unlimited values using the entity metadata wrapper only this is what i have tried

$ewrapper->entity-reference-field->set($value); 

this will overwrite the current value and i want to add to it

1 Answer 1

2

$wrapper->field_foobar[] = $additional_value;

Just change field_foobar to the machine name of your entity reference field.

The empty brackets insure a new value is added rather than overwriting existing value(s).

Good luck!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.