function media_gallery_media_page_edit in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.pages.inc \media_gallery_media_page_edit()
Menu callback; presents the Media editing form in the context of a gallery.
1 string reference to 'media_gallery_media_page_edit'
- media_gallery_menu in ./
media_gallery.module - Implements hook_menu().
File
- ./
media_gallery.pages.inc, line 361 - Common pages for the Media Gallery module.
Code
function media_gallery_media_page_edit($gallery, $file) {
// The Media Gallery module defines titles differently than just using the
// filename.
drupal_set_title(t('<em>Edit @type</em> @title', array(
'@type' => $file->type,
'@title' => _media_gallery_get_media_title($file),
)), PASS_THROUGH);
// Set the breadcrumb.
$node_url_arguments = entity_uri('node', $gallery);
drupal_set_breadcrumb(array(
l(t('Home'), NULL),
l($gallery->title, $node_url_arguments['path'], $node_url_arguments['options']),
));
// We'll be reusing File entity (fieldable files) module's 'file_entity_edit'
// form, so we need to load its include file. In addition to loading it here,
// we also set the include file info within $form_state in case there are
// AJAX enabled widgets that will submit to system/ajax, bypassing this menu
// callback.
module_load_include('inc', 'file_entity', 'file_entity.pages');
$form_state['build_info']['files']['menu'] = array(
'type' => 'inc',
'module' => 'file_entity',
'name' => 'file_entity.pages',
);
// Provide context information for form building and processing functions.
$form_state['media_gallery']['gallery'] = $gallery;
// Since we have a $form_state, we can't call drupal_get_form(), so pass the
// expected arguments to drupal_build_form().
$form_state['build_info']['args'] = array(
$file,
);
return drupal_build_form('file_entity_edit', $form_state);
}