function theme_site_map_menu_link in Site map 8
Same name and namespace in other branches
- 7 includes/site_map.theme.inc \theme_site_map_menu_link()
Returns HTML for a menu link and submenu.
This is a one by one clone of the core theme_menu_link() function that allows custom theming of the site map page items.
Parameters
array $variables: An associative array containing:
- element: Structured array data for a menu link.
Return value
string Returns html string for menu link.
1 string reference to 'theme_site_map_menu_link'
- site_map_theme in ./
site_map.module - Implements hook_theme().
File
- ./
site_map.theme.inc, line 131 - Site map theme functions.
Code
function theme_site_map_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
/** @var \Drupal\Core\Url $url */
$url = $element['#url'];
$url
->setOption('set_active_class', TRUE);
$output = \Drupal::linkGenerator()
->generate($element['#title'], $url);
return '<li' . new Attribute($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}