I was previously using the Default Value PHP field in the CCK Field Properties page to define multi-value default which was working fine. However the code is now getting so complex and I need to pass arguments to it that developing it within the CMS is becoming unfeasible, so I'd like to move the functionality out to a custom module.
I'm successfully using hook_form_alter to set defaults for single value CCK fields, so this isn't a problem. What I'm curious about is that when $form is passed to hook_form_alter, only the first element (0 or $form['field_myfield'][0]) exists, whilst I need to have from 0 to x default values.
Is the best practice simply to clone element 0 for as many default values as I need? Or is there another hook I should be using to set the initial number of empty fields before setting the defaults or something else I'm not thinking of?
Thanks :D