Issue: Classes are being removed from the links. I'm using Special_menu_links, Nice_menus, and Menu-minipanels together. Basically, Nice_menus displays the first and second level horizontally and the third level is a Menu-minipanel. Because Special_menu_links is removing the classes, the Menu-minipanel is not being displayed and the result is <a class="nolink" title="">title</a>.
Here is what I'm trying to do.
1. Add an href="#" which can be done using the admin UI and placing <a href="#"> in place of <a>.
2. Add an onclick="return false" whcih can be done using the admin UI and adding to to number 1 above by writing <a href="#" onclick="return false">.
3. I need the classes to not be removed by Special_menu_links.
Also, everything was working until I updated core and modules.
Moved from Nice_menus 7.x-2.0 to 7.x-2.1
Moved from Special_menu_items 7.x-1.0 to 7.x-2.0
Moved from Menu_minipanels 7.x-1.0-rc2 to 7.x-1.1
This was the code that made Special_menu_links work before in my template.php file. Unfortunately, it doesn't work anymore since the upgrade.
function framework_nice_menus_menu_item_link($variables) {
if (empty($variables['element']['#localized_options'])) {
$variables['element']['#localized_options'] = array();
}
if ($variables['element']['#href'] == '<front>') {
return l($variables['element']['#title'], $variables['element']['#href'], $variables['element']['#localized_options']);
}
$showme = l($variables['element']['#title'], $variables['element']['#href'] = '', $variables['element']['#localized_options'], $variables['element']['#localized_options']['attributes']['onclick'] = 'return false');
if ($variables['element']['#href'] == '<nolink>')) {
return '<a onclick="return false"' . $showme . '>' . $variables['element']['#title'] . '</a>';
} else {
return l($variables['element']['#title'], $variables['element']['#href'], $variables['element']['#localized_options']);
}
}
What I would like to do is to stop Special_menu_items from removing the classes that are supposed to be displayed and only add the class nolink. Mater of fact, I don't really even need the new class. I would like it if Special_menu_items didn't mess with the class.
I appreciate any help that will provide the desired results by modifying the template.php file.
Thanks.
Comments
Comment #1
segi commentedI found a faster solution how can you use at the same time the special menu items and menu minipanels.
In your module you need to implement a hook_module_implements_alter() hook to change the order of modules.