function theme_menu_fields_menu_link in Menu Item Fields 7
Theme a menu link.
Parameters
array $variables: Array where the variables are located.
Return value
string The attributes list.
File
- ./
menu_fields.module, line 215 - Main file contain hooks/functions.
Code
function theme_menu_fields_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
$link = $element['#original_link'];
$render_fields = !isset($link['render_menu_fields']) || $link['render_menu_fields'] !== FALSE;
// Yes, we replace the menu link entirely. What else should we do?
if (isset($element['#menu_fields']) && $element['#menu_fields'] && $render_fields) {
// This is the rendering of the entity, with all attached fields,
// following the display configuration.
$output = drupal_render($element['#menu_fields']);
return $output . "\n";
}
// This is the rendering of a normal link, either from a non menu_fields
// enabled menu, or from within a menu_field entity.
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
if (menu_fields_is_enabled_menu($element['#original_link']['menu_name']) && isset($link['render_menu_fields'])) {
// In the latter case, we don't want the <li> but only the plain link.
return $output;
}
// The rest is drupal default, we don't mangle with that here.
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}