I want to add a class to a menu - doing it in hook_menu won't work because I'm adding an icon with the icon API, and this seems to override any classes put on the menu items.
I have this preprocess function:
/**
* hook_preprocess_page().
*/
function MYMODULE_preprocess_page(&$vars) {
$vars['main_menu']['menu-1914']['attributes']['class'] = array('message');
}
But it doesn't seem to add the css class "message" onto my element.
How do I reliably add a css class to a menu item before display, but before icon API would display it. Theming has to be my weakest Drupal skill.
$vars['main_menu']['menu-1914']['attributes']['class'][] = 'message';
? You need to add another element to the array, not to override it.