system_get_module_admin_tasks

Versions
5 – 7
system_get_module_admin_tasks($module)

▾ 2 functions call system_get_module_admin_tasks()

help_page in modules/help/help.module
Menu callback; prints a page listing general help for all modules.
system_admin_by_module in modules/system/system.module
Menu callback; prints a listing of admin tasks for each installed module.

Code

modules/system/system.module, line 2320

<?php
function system_get_module_admin_tasks($module) {
  $admin_access = user_access('administer access control');
  $menu = menu_get_menu();
  $admin_tasks = array();

  // Check for permissions.
  if (module_hook($module, 'perm') && $admin_access) {
    $admin_tasks[-1] = l(t('Configure permissions'), 'admin/user/access', NULL, NULL, 'module-'. $module);
  }

  // Check for menu items that are admin links.
  if ($items = module_invoke($module, 'menu', TRUE)) {
    foreach ($items as $item) {
      $parts = explode('/', $item['path']);
      $n = count($parts);
      if ((!isset($item['type']) || ($item['type'] & MENU_VISIBLE_IN_TREE)) && ($parts[0] == 'admin') && ($n >= 3) && _menu_item_is_accessible($menu['path index'][$item['path']])) {
        $admin_tasks[$item['title']] = l($item['title'], $item['path']);
      }
    }
  }

  return $admin_tasks;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.