function media_edit in D7 Media 7
Form builder: Builds the edit file form.
2 string references to 'media_edit'
- media_forms in ./
media.module - Implements hook_forms().
- media_page_edit in includes/
media.pages.inc - Menu callback; presents the Media editing form.
File
- includes/
media.pages.inc, line 315 - Common pages for the Media module.
Code
function media_edit($form, &$form_state, $file) {
$form_state['file'] = $file;
field_attach_form('file', $file, $form, $form_state);
$form['#attached'] = array(
'css' => array(
drupal_get_path('module', 'media') . '/css/media.css',
),
);
// Not sure about this class name, seems to indicate the style.
$form['#attributes']['class'][] = 'media-image-left';
$form['#attributes']['class'][] = 'media-edit-form';
$form['preview'] = file_view_file($file, 'media_preview');
$form['preview']['#weight'] = -10;
$form['preview']['#suffix'] = '<div class="no-overflow">';
// Add the buttons.
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['#prefix'] = '</div>';
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#weight' => 15,
'#submit' => array(
'media_edit_delete_submit',
),
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 5,
'#submit' => array(
'media_edit_submit',
),
);
// Add internal file properties needed by media_edit_validate().
foreach (array(
'fid',
'type',
) as $key) {
$form[$key] = array(
'#type' => 'value',
'#value' => $file->{$key},
);
}
return $form;
}