function special_menu_items_link in Special menu items 7.2
Same name and namespace in other branches
- 7 special_menu_items.module \special_menu_items_link()
Override of theme_link().
This function will render link if it is "nolink" or "separator". Otherwise it will call originally overwritten menu_item_link function.
1 string reference to 'special_menu_items_link'
File
- ./
special_menu_items.module, line 65 - The main file for the Special menu items module.
Code
function special_menu_items_link(array $variables) {
if (in_array($variables['path'], array(
'<nolink>',
'<separator>',
))) {
switch ($variables['path']) {
case '<nolink>':
$tag = variable_get('special_menu_items_nolink_tag', '<span>');
$title = $variables['options']['html'] ? $variables['text'] : check_plain($variables['text']);
$variables['options']['attributes']['class'][] = 'nolink';
$variables['options']['attributes']['tabindex'][] = '0';
break;
case '<separator>':
$tag = variable_get('special_menu_items_separator_tag', '<span>');
$title = variable_get('special_menu_items_separator_value', '<hr>');
$variables['options']['attributes']['class'][] = 'separator';
break;
}
$attributes = drupal_attributes($variables['options']['attributes']);
if ($tag != '<a>') {
// <a> tags can have these but a <span> cannot, so we remove them.
foreach (array(
'accesskey',
'target',
'rel',
'name',
) as $attribute) {
$attributes = preg_replace("/ {$attribute}=\".*\"/i", "", $attributes);
}
}
return special_menu_items_render_menu_item($tag, $title, $attributes);
}
// Call the original theme function for normal menu link.
$theme_registry = theme_get_registry();
$function = $theme_registry['special_menu_items_link_default']['function'];
return $function($variables);
}