You are here

function file_entity_add_upload_step_filetype in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7.2 file_entity.pages.inc \file_entity_add_upload_step_filetype()

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

1 call to file_entity_add_upload_step_filetype()
file_entity_add_upload in ./file_entity.pages.inc
Form callback for adding a file via an upload form.

File

./file_entity.pages.inc, line 250
Supports file operations including View, Edit, and Delete.

Code

function file_entity_add_upload_step_filetype($form, &$form_state, array $options = array()) {
  $file = file_load($form_state['storage']['upload']);
  $selected_files = $form['#options']['types'];
  $form['type'] = array(
    '#type' => 'radios',
    '#title' => t('File type'),
    '#options' => file_entity_get_filetype_candidates($file, $selected_files),
    '#default_value' => isset($form_state['storage']['type']) ? $form_state['storage']['type'] : NULL,
    '#required' => TRUE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['previous'] = array(
    '#type' => 'submit',
    '#value' => t('Previous'),
    '#limit_validation_errors' => array(),
    '#submit' => array(
      'file_entity_add_upload_submit',
    ),
  );
  $form['actions']['next'] = array(
    '#type' => 'submit',
    '#value' => t('Next'),
  );
  return $form;
}