Add classes to these links
I hope I understand your question. If you want to add class to l(), then it must be an array, so your "$link=..." line would read

$link = l($output, $element['#href'], array('attributes' =&gt; array('class' =&gt; array('YOUR_CLASS_NAME')), 'html' =&gt; TRUE));


You can also read more and see other examples in Drupal's l() documentation

Hope this helps.