function system_admin_menu_block
Provide a single block on the administration overview page.
Parameters
$item: The menu item to be displayed.
4 calls to system_admin_menu_block()
- node_add_page in modules/
node/ node.pages.inc - Page callback: Displays add content links for available content types.
- system_admin_config_page in modules/
system/ system.admin.inc - Menu callback; Provide the administration overview page.
- system_admin_menu_block_page in modules/
system/ system.admin.inc - Provide a single block from the administration menu as a page.
- system_settings_overview in modules/
system/ system.admin.inc - Displays the configuration overview page.
File
-
modules/
system/ system.module, line 2143
Code
function system_admin_menu_block($item) {
$cache =& drupal_static(__FUNCTION__, array());
// If we are calling this function for a menu item that corresponds to a
// local task (for example, admin/tasks), then we want to retrieve the
// parent item's child links, not this item's (since this item won't have
// any).
if ($item['tab_root'] != $item['path']) {
$item = menu_get_item($item['tab_root_href']);
}
if (!isset($item['mlid'])) {
$item += db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = :path AND module = 'system'", array(
':path' => $item['path'],
))->fetchAssoc();
}
if (isset($cache[$item['mlid']])) {
return $cache[$item['mlid']];
}
$content = array();
$query = db_select('menu_links', 'ml', array(
'fetch' => PDO::FETCH_ASSOC,
));
$query->join('menu_router', 'm', 'm.path = ml.router_path');
$query->fields('ml')
->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array(
'weight',
)))
->condition('ml.plid', $item['mlid'])
->condition('ml.menu_name', $item['menu_name'])
->condition('ml.hidden', 0);
foreach ($query->execute() as $link) {
_menu_link_translate($link);
if ($link['access']) {
// The link description, either derived from 'description' in
// hook_menu() or customized via menu module is used as title attribute.
if (!empty($link['localized_options']['attributes']['title'])) {
$link['description'] = $link['localized_options']['attributes']['title'];
unset($link['localized_options']['attributes']['title']);
}
// Prepare for sorting as in function _menu_tree_check_access().
// The weight is offset so it is always positive, with a uniform 5-digits.
$key = 50000 + $link['weight'] . ' ' . drupal_strtolower($link['title']) . ' ' . $link['mlid'];
$content[$key] = $link;
}
}
ksort($content);
$cache[$item['mlid']] = $content;
return $content;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.