You are here

function uploadfield_widget in Video 6.3

Same name and namespace in other branches
  1. 6.5 types/uploadfield/uploadfield.module \uploadfield_widget()
  2. 6.4 types/uploadfield/uploadfield.module \uploadfield_widget()

Implementation of CCK's hook_widget().

Assign default properties to item and delegate to FileField.

File

types/uploadfield/uploadfield.module, line 228

Code

function uploadfield_widget(&$form, &$form_state, $field, $items, $delta = 0) {

  // Add default values to items.
  // TODO: use CCK's default value callback.
  if (empty($items[$delta])) {
    $items[$delta] = array(
      'alt' => '',
      'title' => '',
    );
  }

  // Start with the FileField widget as a basic start.
  // Note that FileField needs to modify $form by reference.
  $element = filefield_widget($form, $form_state, $field, $items, $delta);

  // Add uploadfield specific validators.
  //  $element['#upload_validators'] = array_merge($element['#upload_validators'], uploadfield_widget_upload_validators($field));
  return $element;
}