1 file.pages.inc file_add_upload_step_fields($form, &$form_state, array $options = array())

Generate form fields for the fourth step in the add file wizard.

File

core/modules/file/file.pages.inc, line 154
Supports file operations including Manage and Delete.

Code

function file_add_upload_step_fields($form, &$form_state, array $options = array()) {
  backdrop_set_title(t('Configure file fields'));
  // Load the file and overwrite the filetype set on the previous screen.
  $file = file_load($form_state['storage']['upload']);
  $file->type = $form_state['storage']['type'];

  // Let users modify the filename here.
  $form['filename'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#default_value' => $file->filename,
    '#required' => TRUE,
    '#maxlength' => 255,
    '#weight' => -10,
  );

  // Add fields.
  field_attach_form('file', $file, $form, $form_state);

  $form['actions']['previous'] = array(
    '#type' => 'submit',
    '#value' => t('Previous'),
    '#limit_validation_errors' => array(),
    '#submit' => array('file_add_form_submit'),
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );

  return $form;
}