function void_menu_translated_menu_link_alter in Void Menu 8.x
Same name and namespace in other branches
- 7.x void_menu.module \void_menu_translated_menu_link_alter()
Implements hook_translated_menu_link_alter().
File
- ./
void_menu.module, line 75 - Creates placeholders for menu items to use special paths, including but not limited to javascript function calls. ------------------------------------------ Written by William Hall - www.mrtheme.com Based off of special_menu_items and…
Code
function void_menu_translated_menu_link_alter(&$item, $map) {
if ($item['module'] == 'menu') {
$href = $item['href'];
/**
* Sets variable matching for menu items.
*/
if (preg_match('/(<void)/is', $item['link_path'])) {
$item['options']['alter'] = TRUE;
$item['options']['external'] = TRUE;
if ($item['link_path'] == '<void>') {
$href = variable_get('void_menu_link_value', 'javascript: void(0);');
}
else {
if (preg_match('/.*?(\\d+)/is', $item['link_path'], $i)) {
$href = variable_get('void_menu_link_value' . $i[1], $i[1] == 1 ? '#' : '');
}
}
}
else {
unset($item['options']['unaltered_hidden']);
}
$item['href'] = $href;
}
}