I have written a module that adds some additional menu items to the Administration Menu. My method of doing this seemed to work up through 6.x-3.0-alpha1, but as of 6.x-3.0-alpha2 doesn't seem to work. I assumed that this was because of the newly-added hook_admin_menu_output_alter() interface, which seems like a good idea. However, in trying to implement this hook in my module, I realized that if one modifies $content['links'] in this hook, the modifications are not accessed anywhere else in the module:

[ghing@drupal admin_menu]$ grep -r "\['links'\]" *
admin_menu.api.php: * $content['links'] contains additional top-level links in the Administration
admin_menu.api.php: $content['links']['myitem'] = array(
admin_menu.api.php: $content['links']['myitem']['cron'] = array(

Also, doing a var_dump of $content in my implementation of the hook showed that the array contained no 'links' item when it is passed to the hook. I found that I was able to insert additional menu items by altering $content['menu'] but this seemed like a pretty messy way of adding the menu items that I wanted.

What is the roadmap for finishing the implementation for this hooks so it functions as documented in the comments?

"* $content['links'] contains additional top-level links in the Administration
* menu, such as the icon menu or the logout link. You can add more items here
* or play with the #weight attribute to customize them."

Best,
Geoff

Comments

sun’s picture

Category: bug » task

True. The new contents are:

    // Add administration menu.
    $content['menu'] = admin_menu_links_menu(menu_tree_all_data('admin_menu'));
    $content['menu']['#theme'] = 'admin_menu_links';
    // Ensure the menu tree is rendered between the icon and user links.
    $content['menu']['#weight'] = 0;
    // Do not sort the menu tree, since it is sorted already.
    $content['menu']['#sorted'] = TRUE;

    // Add menu additions.
    $content['icon'] = admin_menu_links_icon();
    $content['user'] = admin_menu_links_user();

    // Allow modules to alter the output.
    drupal_alter('admin_menu_output', $content);
    $content = drupal_render($content);
sun’s picture

Version: 6.x-3.0-alpha3 » 6.x-3.0-alpha4
Category: task » bug
Status: Active » Fixed

Thanks for reporting, reviewing, and testing! Committed a fix to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.