How to pre populate a field collection field with multiple values?
I have a node type with a field collection field which has four fields and cardinality is set to unlimited.
In my custom module I implement hook_form_alter and assign default values to the collection inside a loop, but it displays only one field collection. I tried to set the cardinality of the field collection field to the number of items I want, but failed as I can't find a way to set the cardinality programmatically.