function media_gallery_preprocess_menu_local_task in Media Gallery 7
Same name and namespace in other branches
- 7.2 media_gallery.module \media_gallery_preprocess_menu_local_task()
Implements MODULE_preprocess_menu_local_task().
File
- ./
media_gallery.module, line 1219
Code
function media_gallery_preprocess_menu_local_task(&$variables) {
// Persist the "page" URL query parameter from the "view" tab to the
// "multiedit" tab for gallery nodes. In the future, we may want to expand
// this to cover more than just the "multiedit" tab. Since this code runs for
// every local task of every page, we try to determine no-op conditions as
// quickly as possible.
if (isset($_GET['page']) && !isset($variables['element']['#link']['localized_options']['query']['page']) && strpos($variables['element']['#link']['href'], 'node/') == 0) {
$nid = arg(1, $variables['element']['#link']['href']);
if (is_numeric($nid) && arg(2, $variables['element']['#link']['href']) == 'multiedit') {
$node = node_load($nid);
if ($node->type == 'media_gallery') {
$page = pager_find_page(MEDIA_GALLERY_PAGER_ELEMENT);
if (is_int($page)) {
$variables['element']['#link']['localized_options']['query']['page'] = "{$page}";
}
}
}
}
}