Devel noob here. I am writing a module where I need to stash a list of entity ids in a field on a different entity. I've created a field on an entity type programmatically and have it set as field type list(integer), but I'm stuck at actually working with the field data.
How can I add/edit entity ids in the field list programmatically?
For context, this is a Commerce submodule and I am adding to a field on the line item created after submitting an add to cart form. Using dsm($form_data)
in a submit handler I added to the add to cart form, I see that the line item object is already stored in $form_data['line_item']
and the data I need to get to would be stored at $form_data['line_item']->field_entity_ids
. By this point, I already have my array of ids, I just need some guidance on how to store them properly in the field.
Thanks in advance! :)