If there are leading, trailing or double spaces, they will considered as class because of explode(' ', ' class-2 class-6'). Spaces should be trimmed and stripped or empty classes just ignored.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

osopolar’s picture

osopolar’s picture

Status: Active » Needs review
quicksketch’s picture

A simpler way of handling this problem is wrapping the explode() call in array_filter():

$classes = array_filter(explode(' ', $item['options']['attributes']['class']));
amateescu’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
Status: Needs review » Fixed

Committed a fix to 7.x-1.x. Thanks for catching this :)

http://drupalcode.org/project/menu_attributes.git/commitdiff/38cb713

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.