Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've recently updated Radix in our distribution (from a very out of date version), and the theming of menus has changes. I've fixed up our navbar (it used a custom ctools content type), however, now any instances of main_menu that we have added as panels panes no longer have dropdowns.
How can I enable other menu instances to be rendered with dropdown classes?
I've tried the below in menu.inc, but did not affect my menu panes.
function theme_preprocess_menu_link(&$variables) {
// Assuming the menu you want to have dropdows has the name "menu_with_dropdowns"
if ($variables['element']['#original_link']['menu_name'] == 'main_menu') {
$variables['theme_hook_suggestion'] = 'menu_link__dropdown';
}
}
Comments
Comment #2
PI_Ron CreditAttribution: PI_Ron commentedI had the menu name value incorrect in my code.
ie. 'main-menu' instead of 'main_menu'.
All fixed :-)
Comment #3
PI_Ron CreditAttribution: PI_Ron commentedComment #4
PI_Ron CreditAttribution: PI_Ron commentedClosed resolved.