Drupal 5’s system_get_module_admin_tasks() function attempts to ferret out any administrator pages that a given module provides, and is used to add them to each module’s section on the admin/by-module screen. If you provide admin help in your implementation of hook_help() it will also automatically display links to those administrator pages at the bottom of the admin/help/mymodule page (where mymodule is the name of your hypothetical module.)
Typically you would allow the menu items for those administrator pages to be cached:
<?php
/** A typical implementation of hook_menu(): */
function mymodule_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/mymodule',
'access' => user_access('access administration pages'),
'callback' => 'mymodule_admin_form'
);
}
else {
//Dynamic, non-cached menu items here
}
return $items;
}
?>
However, if you’re following the common practice of disabling caching for all of your menu items during module development, you’ll find that those automatic administrator page links don’t get generated. This makes sense once you realize that system_get_module_admin_tasks() only looks at cached menu items, but it’s the sort of subtle behavior that you wouldn’t necessarily know about without digging into the Drupal core, and might mistake for some kind of bug. When in doubt, the Drupal online API Documentation is your friend!

Delicious
Digg
Facebook
Google
Yahoo

Post new comment