function menu_block_get_title in Menu Block 6.2
Same name and namespace in other branches
- 7.3 menu_block.module \menu_block_get_title()
- 7.2 menu_block.module \menu_block_get_title()
Retrieves the menu item to use for the tree's title.
Parameters
$render_title_as_link: boolean A boolean that says whether to render the title as a link or a simple string.
Return value
string The tree's title rendered as a string.
1 call to menu_block_get_title()
- menu_tree_build in ./
menu_block.module - Build a menu tree based on the provided configuration.
File
- ./
menu_block.module, line 367 - Provides configurable blocks of menu items.
Code
function menu_block_get_title($render_title_as_link = TRUE, $config = array()) {
$menu_item = menu_block_set_title();
// The tree's title is a menu title, a normal string.
if (is_string($menu_item)) {
$title = check_plain($menu_item);
}
elseif ($render_title_as_link) {
if (!empty($menu_item['in_active_trail'])) {
if (!empty($menu_item['localized_options']['attributes']['class'])) {
$menu_item['localized_options']['attributes']['class'] .= ' active-trail';
}
else {
$menu_item['localized_options']['attributes']['class'] = 'active-trail';
}
}
$hooks = array();
if (!empty($config['delta'])) {
$hooks[] = 'menu_item_link__menu_block__' . str_replace('-', '_', $config['delta']);
}
$hooks[] = 'menu_item_link__menu_block__' . str_replace('-', '_', $menu_item['menu_name']);
$hooks[] = 'menu_item_link__menu_block';
$hooks[] = 'menu_item_link';
$title = theme($hooks, $menu_item);
}
else {
$title = check_plain($menu_item['title']);
}
return $title;
}