function _site_map_menus in Site map 7
Same name and namespace in other branches
- 8 site_map.module \_site_map_menus()
- 5 site_map.module \_site_map_menus()
- 6.2 site_map.module \_site_map_menus()
- 6 site_map.module \_site_map_menus()
Render the latest maps for all the menus.
Return value
string Returns HTML string of site map for menus.
1 call to _site_map_menus()
- template_preprocess_site_map in includes/
site_map.theme.inc - Preprocesses the variables for site-map.tpl.php.
File
- ./
site_map.module, line 489 - site_map.module
Code
function _site_map_menus($mid) {
$output = '';
$class = array();
$options = array();
if (!empty($mid)) {
$menu = menu_load($mid);
// Use menu_tree_all_data to retrieve the expanded tree.
$tree = menu_tree_all_data($mid);
if (module_exists('i18n_menu')) {
$tree = i18n_menu_localize_tree($tree, $GLOBALS['language']->language);
}
// Add an alter hook so that other modules can manipulate the
// menu tree prior to rendering.
$alter_mid = preg_replace('/[^a-z0-9_]+/', '_', $mid);
drupal_alter(array(
'site_map_menu_tree',
'site_map_menu_tree_' . $alter_mid,
), $tree, $menu);
$menu_display = _site_map_menu_tree_output($tree);
$menu_html = drupal_render($menu_display);
if (!empty($menu_html)) {
// @codingStandardsIgnoreLine
$title = t($menu['title']);
if (module_exists('i18n_string')) {
$m_array = array(
'menu',
'menu',
$menu['menu_name'],
'title',
);
$title = i18n_string_plain($m_array, $title);
}
_site_map_set_option($options, 'site_map_show_titles', 1, 1, 'show_titles', TRUE);
$class[] = 'site-map-box-menu';
$class[] = 'site-map-box-menu-' . $mid;
$attributes = array(
'class' => $class,
);
$output .= theme('site_map_box', array(
'title' => $title,
'content' => $menu_html,
'attributes' => $attributes,
'options' => $options,
));
}
}
return $output;
}