You are here

function file_entity_test_edit_form in D7 Media 7

Form callback; edit a file.

1 string reference to 'file_entity_test_edit_form'
file_entity_test_menu in file_entity/tests/file_entity_test.module
Implements hook_menu().

File

file_entity/tests/file_entity_test.pages.inc, line 57
Test pages for the File Entity Test module.

Code

function file_entity_test_edit_form($form, &$form_state, $file) {
  $form_state['file'] = $file;
  field_attach_form('file', $file, $form, $form_state);
  $form['file'] = file_view($file, 'file_entity_test_preview');

  // Add internal file properties needed by
  // file_entity_test_edit_form_validate().
  foreach (array(
    'fid',
    'type',
  ) as $key) {
    $form[$key] = array(
      '#type' => 'value',
      '#value' => $file->{$key},
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}