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

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!

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.