function filefield_default_value in FileField 6.3
Implementation of CCK's hook_default_value().
Note this is a widget-level hook, so it does not affect ImageField or other modules that extend FileField.
See also
File
- ./
filefield.module, line 416 - FileField: Defines a CCK file field type.
Code
function filefield_default_value(&$form, &$form_state, $field, $delta) {
// Reduce the default number of upload fields to one. CCK 2 (but not 3) will
// automatically add one more field than necessary. We use the
// content_multiple_value_after_build function to determine the version.
if (!function_exists('content_multiple_value_after_build') && !isset($form_state['item_count'][$field['field_name']])) {
$form_state['item_count'][$field['field_name']] = 0;
}
// The default value is actually handled in hook_widget().
// hook_default_value() is only helpful for new nodes, and we need to affect
// all widgets, such as when a new field is added via "Add another item".
return array();
}