我需要在template.php(Drupal 7)中通过Hook进行以下结构:
<ul class="first border">
<li><a href="#link"><span class="big">Main Menu Title</span><span class="small">Main Menu Description</span></a><ul class="flyout"><li class="submenu"><a href="#link">Submenu Item</a></li></ul></li></ul>
我在template.php中的当前状态如下:
function mytheme_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
$element['#localized_options']['html'] = TRUE;
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
if ($element['#original_link']['menu_name'] == "main-menu" && isset($element['#localized_options']['attributes']['title'])){
$element['#title'] .= '<span class="description">' . $element['#localized_options']['attributes']['title'] . '</span>';
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
我尝试了一些但没有成功。