function system_get_module_admin_tasks in Drupal 6
Same name and namespace in other branches
- 8 core/modules/system/system.module \system_get_module_admin_tasks()
- 5 modules/system/system.module \system_get_module_admin_tasks()
- 7 modules/system/system.module \system_get_module_admin_tasks()
- 9 core/modules/system/system.module \system_get_module_admin_tasks()
Generate a list of tasks offered by a specified module.
Parameters
$module: Module name.
Return value
An array of task links.
2 calls to system_get_module_admin_tasks()
- help_page in modules/
help/ help.admin.inc - Menu callback; prints a page listing general help for a module.
- system_admin_by_module in modules/
system/ system.admin.inc - Menu callback; prints a listing of admin tasks for each installed module.
File
- modules/
system/ system.module, line 1269 - Configuration system that lets administrators modify the workings of the site.
Code
function system_get_module_admin_tasks($module) {
static $items;
$admin_access = user_access('administer permissions');
$admin_tasks = array();
if (!isset($items)) {
$result = db_query("\n SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, ml.*\n FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.link_path LIKE 'admin/%' AND hidden >= 0 AND module = 'system' AND m.number_parts > 2");
$items = array();
while ($item = db_fetch_array($result)) {
_menu_link_translate($item);
if ($item['access']) {
$items[$item['router_path']] = $item;
}
}
}
$admin_tasks = array();
$admin_task_count = 0;
// Check for permissions.
if (module_hook($module, 'perm') && $admin_access) {
$admin_tasks[-1] = l(t('Configure permissions'), 'admin/user/permissions', array(
'fragment' => 'module-' . $module,
));
}
// Check for menu items that are admin links.
if ($menu = module_invoke($module, 'menu')) {
foreach (array_keys($menu) as $path) {
if (isset($items[$path])) {
$admin_tasks[$items[$path]['title'] . $admin_task_count++] = l($items[$path]['title'], $path);
}
}
}
return $admin_tasks;
}