I'm setting up a new field that has two upload fields and a text area for content. I found the managed_file type and that seems to be the easiest way to go but when I add the fields, they aren't showing up in the node edit form:

  $widget['download_fid'] = array(
    '#type' => 'managed_file',
    '#title' => t('Download'),
    '#default_value' => isset($items[$delta]['download_fid']) ? $items[$delta]['download_fid'] : 0,
    '#upload_location' => 'public://mytestdownloads/',
  );
  $widget['cover_fid'] = array(
    '#type' => 'managed_file',
    '#title' => t('Cover'),
    '#default_value' => isset($items[$delta]['cover_fid']) ? $items[$delta]['cover_fid'] : 0,
    '#upload_location' => 'public://mytestcover/',
  );
  $widget['download_content'] = array(
    '#type' => 'textfield',
    '#title' => t('Content'),
    '#default_value' => isset($items[$delta]['download_content']) ? $items[$delta]['download_content'] : NULL,
  );

  return $widget;

Is there something I'm missing? The textfield shows up but not the two upload fields.

Comments

ytsurk’s picture

do you have the file field enabled ? (in module list)

aha - interesting ..

jjkiesch’s picture

whoops! yep, that was the problem. thanks!