Download & Extend

Theming - using menu name instead of mlid in the id

Project:DHTML Menu
Version:7.x-1.0-beta1
Component:PHP Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi there

I'm in a bit of a silly situation at work where it's rather inconvenient to have the menu class id done by the menu number. I've modified the code from line 37 onward in dhtml_menu_theme.inc to use the menu name rather than the mlid:

<?php
// Add the ID and class attributes.
  // get the link title rather than mlid and make it lowercase
 
 
$menu_class_id = _dhtml_menu_unique_id(strtolower($l['link_title']));
 
 
// replace spaces with dashes
 
 
$menu_class_id = str_replace(' ', '-', $menu_class_id);
 
 
// send finished id through
  // also replacing _ with -
 
 
$variables['element']['#attributes']['id'] = 'dhtml-menu-' . $menu_class_id;
 
$variables['element']['#attributes']['class'][] = 'dhtml-menu';
?>

It appears to have not exploded yet, is there a timebomb waiting to happen somewhere by doing this?

nobody click here