function media_gallery_media_page_multiedit in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.pages.inc \media_gallery_media_page_multiedit()
Menu callback; presents the Media multiedit form in the context of a gallery.
1 string reference to 'media_gallery_media_page_multiedit'
- media_gallery_menu in ./
media_gallery.module - Implements hook_menu().
File
- ./
media_gallery.pages.inc, line 393 - Common pages for the Media Gallery module.
Code
function media_gallery_media_page_multiedit($node) {
// Determine the media entities to edit.
$columns = $node->media_gallery_columns[LANGUAGE_NONE][0]['value'];
$rows = $node->media_gallery_rows[LANGUAGE_NONE][0]['value'];
$number_per_page = $columns * $rows;
$current_page = isset($_GET['page']) ? $_GET['page'] : 0;
$items = array_slice($node->media_gallery_file[LANGUAGE_NONE], $current_page * $number_per_page, $number_per_page);
$fids = array();
foreach ($items as $item) {
$fids[] = $item['fid'];
}
$files = file_load_multiple($fids);
$files = media_gallery_filter_media_access($files, 'update');
// Load the Media module include file containing the form callback.
// @todo To support AJAX enabled widgets within the form, we need to also add
// media.pages.inc to $form_state['build_info']['files']['menu']. Figure out
// how to integrate that properly with the Multiform module.
module_load_include('inc', 'media', 'includes/media.pages');
// Build and process the form.
$form = media_bulk_upload_file_operation_edit_multiple($files);
// Override the page title set by media_file_page_edit_multiple() and return the form.
drupal_set_title(t('<em>Edit media for</em> @title', array(
'@type' => $node->type,
'@title' => $node->title,
)), PASS_THROUGH);
return $form;
}