' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title"; } } // Otherwise, return an empty string. return ''; } /* * Converts a string to a suitable html ID attribute. * * http://www.w3.org/TR/html4/struct/global.html#h-7.5.2 specifies what makes a * valid ID attribute in HTML. This function: * * - Ensure an ID starts with an alpha character by optionally adding an 'n'. * - Replaces any character except A-Z, numbers, and underscores with dashes. * - Converts entire string to lowercase. * * @param $string * The string * @return * The converted string */ function basic_id_safe($string) { // Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores. $string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string)); // If the first character is not a-z, add 'n' in front. if (!ctype_lower($string{0})) { // Don't use ctype_alpha since its locale aware. $string = 'id'. $string; } return $string; } /** * Generate the HTML output for a menu link and submenu. * * @param $variables * An associative array containing: * - element: Structured array data for a menu link. * * @return * A themed HTML string. * * @ingroup themeable */ function basic_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = drupal_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); // Adding a class depending on the TITLE of the link (not constant) $element['#attributes']['class'][] = basic_id_safe($element['#title']); // Adding a class depending on the ID of the link (constant) $element['#attributes']['class'][] = 'mid-' . $element['#original_link']['mlid']; return '