Scroll
Tematización de menús (template.php)
Foros
Hello, in the template.php file I insert the following code:
function theme_name_menu_link__main_menu(array $variables) {
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$output = '<span>' . l($element['#title'], $element['#href'], $element['#localized_options']) . '</span>';
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
But the <span> tag does not appear.
function theme_name_links__system_main_menu(&$vars) {
foreach ($vars['links'] as &$link) {
$link['title'] = '<span>' . $link['title'] . '</span>';
$link['html'] = TRUE;
}
return theme_links($vars);
}
This construction works, but the wrapper is not where I need it — inside the <a><span></span></a> tag.
Could you please explain why the first construction does not work?
- Inicie sesión o registrese para enviar comentarios