function file_entity_add_upload_step_fields in File Entity (fieldable files) 7.3
Same name and namespace in other branches
- 7.2 file_entity.pages.inc \file_entity_add_upload_step_fields()
Generate form fields for the fourth step in the add file wizard.
1 call to file_entity_add_upload_step_fields()
- 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 330 - Supports file operations including View, Edit, and Delete.
Code
function file_entity_add_upload_step_fields($form, &$form_state, array $options = array()) {
// 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'] = 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']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}