Skip to main content
Major grammar rewrite.
Source Link
Letharion
  • 27.5k
  • 11
  • 83
  • 141

How to prepolatepre populate a node add form with multiple field collection items?

I haveHow to pre populate a node which has one field and one field collection field, the 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 data as default valuevalues to the field and the field collection fields inside a loop(loop goes for 32 times). But, but it displays only one field collection. I tried to set the cardinality of the field collection field to 32the number of items I want, but failed(can't as I can't find a way to set the cardinality programmatically). How to prepopulate this type of node?

How to prepolate a node add form?

I have a node which has one field and one field collection field, the field collection field has four fields and cardinality is set to unlimited. In my custom module I implement hook_form_alter and assign data as default value to the field and the field collection fields inside a loop(loop goes for 32 times). But it displays only one field collection. I tried to set the cardinality of the field collection field to 32, but failed(can't find a way to set the cardinality programmatically). How to prepopulate this type of node?

How to pre populate a node add form with multiple field collection items?

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.

Source Link
rongok
  • 163
  • 2
  • 11

How to prepolate a node add form?

I have a node which has one field and one field collection field, the field collection field has four fields and cardinality is set to unlimited. In my custom module I implement hook_form_alter and assign data as default value to the field and the field collection fields inside a loop(loop goes for 32 times). But it displays only one field collection. I tried to set the cardinality of the field collection field to 32, but failed(can't find a way to set the cardinality programmatically). How to prepopulate this type of node?