function menu_add_link_labels in Drupal 7
Adds labels to the title of a hidden, unpublished or logged-in menu link.
Parameters
string $title: The title of the menu link. This will be modified as necessary to add the appropriate label in parentheses at the end.
array $item: An array representing the menu link item.
2 calls to menu_add_link_labels()
- _menu_overview_tree_form in modules/
menu/ menu.admin.inc - Recursive helper function for menu_overview_form().
- _menu_parents_recurse in modules/
menu/ menu.module - Recursive helper function for menu_parent_options().
File
- modules/
menu/ menu.module, line 457 - Allows administrators to customize the site's navigation menus.
Code
function menu_add_link_labels(&$title, $item) {
if ($item['hidden']) {
$title .= ' (' . t('disabled') . ')';
}
elseif (!empty($item['node_unpublished'])) {
$title .= ' (' . t('unpublished') . ')';
}
elseif ($item['link_path'] == 'user' && $item['module'] == 'system') {
$title .= ' (' . t('logged in users only') . ')';
}
}