function custom_breadcrumbs_theme_menu_item_link in Custom Breadcrumbs 7.2
Same name and namespace in other branches
- 6.2 custom_breadcrumbs.module \custom_breadcrumbs_theme_menu_item_link()
Preprocessor for menu_item_link.
Adds an ID attribute to menu links and helps the module follow the recursion of menu_tree_output().
@codingStandardsIgnoreStart
Parameters
array $link: A menu link.
1 string reference to 'custom_breadcrumbs_theme_menu_item_link'
File
- ./
custom_breadcrumbs.module, line 1051 - Main file for the Custom breadcrumbs.
Code
function custom_breadcrumbs_theme_menu_item_link($link) {
// @codingStandardsIgnoreEnd
// Find out which theme function to dispatch to after preprocessing.
global $theme;
static $function;
if (!isset($function)) {
$registry = variable_get('custom_breadcrumbs_menu_theme', array());
$function = isset($registry[$theme]) ? $registry[$theme]['menu_item_link'] : 'theme_menu_item_link';
}
if (isset($link['mlid'])) {
// Some themes use options, others use localized_options. Populate both.
$link['localized_options']['attributes']['id'] = 'custom_breadcrumbs_menu-' . _custom_breadcrumbs_menu_unique_id($link['mlid']);
$link['options']['attributes']['id'] = $link['localized_options']['attributes']['id'];
// Each link in series is another level of recursion. Add it to the stack.
_custom_breadcrumbs_menu_stack($link);
if (custom_breadcrumbs_in_active_trail($link)) {
$link['localized_options']['attributes']['class'] = 'active';
}
}
// Pass the altered variables to the normal menu themer.
return $function($link);
}