Hello,

Thank you for this module !

if the entered tag for nolink is <a href="#">, the following code removes all attributes for the a tag when it should keep them.

//special_menu_items.module @ 66
    if ($tag != '<a>') {
      // <a> tags can have these but a <span> cannot, so we remove them.
      foreach (array('accesskey', 'target', 'rel', 'name') as $attribute) {
        $attributes = preg_replace("/ $attribute=\".*\"/i", "", $attributes);
      }
    }

Something clever has to made.. for this if() statement.

Take care !

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

coxw’s picture

I agree, I'm not sure the attributes should be stripped since even accesskey is a global attribute.

coxw’s picture

Issue summary: View changes

better code formatting

energee’s picture

Fixes preg_replace

energee’s picture

Status: Active » Needs review
matpoppl’s picture

Hello.

The purpose of the preg_replace is to remove unwanted attributes in non-anchor tags. I think that it would be better to drop preg_replace and use array_diff_key a step before the attributes are converted to string.