Modify the links in admin_menu through the use of the hook_admin_menu_output_alter() function

Feb
2014
09

How can you modify the links in admin_menu? Through the use of the hook_admin_menu_output_alter() function. For example if you would like to hide the 'Tasks' and 'Index' Links from the admin toolbar or hide the structure / taxonomy Menu links and just add a custom Link using a drupal custom taxonomy vocabulary access module, just use the following hook in my case i removed the admin/index & admin/structure menu links (use dpm() to find the approriate $content['menu'] array items)

<?php
/**
 * Implements hook_admin_menu_output_alter().
 */
function validator_admin_menu_output_alter(&$content) {
 
// Hide "Structure" and "Index" links.
  //dpm($content);
 
global $user;
   
// Remove admin menu items for user 10
   
if($user->uid == 10) {
    unset(
$content['menu']['admin/index']);
    unset(
$content['menu']['admin/structure']);
    }
  }
?>
this is an arrow pointing back to the top of the page