Keeping $attributes but adding a rel (D7) I have the following piece of code:

l('&lt;div class="magnifier gradient"&gt;&lt;/div&gt;' . $image, $link_path, array('html' =&gt; TRUE, 'attributes' =&gt; $attributes))


Which creates a nice link, as it should be. Now I want to add a rel-attribute without getting rid off $attributes (because I need that one). I have Googled and tried a lot, but nothing seems to work. So if anyone can help me with just adding a rel-attribute without deleting the other attributes, I would be grateful!

Thanks
If I understand you right you just want to add the rel attribute to the $attributes array before you call l(). Something like this:

$attributes['rel'] = 'the_rel';
print l('&lt;div class="magnifier gradient"&gt;&lt;/div&gt;' . $image, $link_path, array('html' =&gt; TRUE, 'attributes' =&gt; $attributes));


That will add the an item to the $attributes array with a key of rel and a value of the_rel, and won't affect any of the other attributes already in the array.