You are here

function media_gallery_menu_local_tasks_alter in Media Gallery 7.2

Same name and namespace in other branches
  1. 7 media_gallery.module \media_gallery_menu_local_tasks_alter()

Implements hook_menu_local_tasks_alter().

File

./media_gallery.module, line 216

Code

function media_gallery_menu_local_tasks_alter(&$data, $router_item, $root_path) {

  // Rename the "Edit" tab on gallery nodes to "Edit gallery".
  if (($node = menu_get_object()) && isset($node->type) && $node->type == 'media_gallery' && !empty($data['tabs'])) {
    $tabs =& $data['tabs'][0]['output'];
    foreach ($tabs as &$tab) {
      if (isset($tab['#link']['path']) && $tab['#link']['path'] == 'node/%/edit') {
        $tab['#link']['title'] = t('Edit gallery');
      }
    }
  }

  // Rename the "Edit" tab on the "All Galleries" taxonomy term to "Edit all
  // galleries" and point it to our configuration page.
  // @todo: Once we have additional gallery-related taxonomy terms and
  //   http://drupal.org/node/678592 is committed to core (so the term edit
  //   pages show the correct admin theme) we'll do something different here,
  //   perhaps not even alter anything at all.
  if (($term = menu_get_object('taxonomy_term', 2)) && isset($term->vid) && $term->vid == variable_get('media_gallery_collection_vid')) {
    $tabs =& $data['tabs'][0]['output'];
    foreach ($tabs as &$tab) {
      if (isset($tab['#link']['path']) && $tab['#link']['path'] == 'taxonomy/term/%/edit') {
        $tab['#link']['href'] = 'admin/config/media/galleries';
        $tab['#link']['title'] = t('Edit all galleries');
      }
    }
  }
}