function dhtml_menu_menus in DHTML Menu 6.3
Build human-readable menu names for book menus. This fetches the title of the book outline's root node. Titles are cached for performance.
1 call to dhtml_menu_menus()
- dhtml_menu_settings in ./
dhtml_menu.admin.inc - Module settings form.
3 string references to 'dhtml_menu_menus'
- dhtml_menu_update_6000 in ./
dhtml_menu.install - #6000: 6.x-2.x upgrade. Custom blocks are gone, using preprocess instead.
- dhtml_menu_update_6001 in ./
dhtml_menu.install - #6001: 6.x-2.1 upgrade. A two-dimensional array is now used for these settings, indexing by module and block delta.
- dhtml_menu_update_6002 in ./
dhtml_menu.install - #6002: 6.x-3.x upgrade. All existing variables are obsolete.
File
- ./
dhtml_menu.admin.inc, line 41 - dhtml_menu.admin.inc Functions that are only called on the admin pages.
Code
function dhtml_menu_menus() {
$titles = cache_get('dhtml_book_titles');
$titles = isset($titles->data) ? $titles->data : array();
$menu_internal = menu_get_names();
foreach ($menu_internal as $key) {
if (preg_match('/book-toc-([0-9]+)/', $key, $match)) {
if (!isset($titles[$match[1]])) {
$node = node_load($match[1]);
$titles[$match[1]] = $node->title;
}
$menus[$key] = t('Book: %title', array(
'%title' => $titles[$match[1]],
));
}
else {
$menus[$key] = $key;
}
}
cache_set('dhtml_book_titles', $titles);
return $menus;
}