The new HTML5 data-* attribute can be specified on any element but I noticed that you have already an API file in your module folder to add additional attributes to menu links.

I wanted to add the following code but was only able to hack the modules function menu_attributes_menu_attribute_info

 // Add a data-toggle attribute.
  $info['data-toggle'] = array(
    'label' => t('Data Toggle'),
    'description' => t('Specifies a HTML5 Data- attribute. This is a data-toggle attribute for the Twitter Bootstrap dropdown menu. '),
    'form' => array(
      '#maxlength' => 20,
      '#size' => 20,
    ),
  );

How do I add additional attributes? By including the API code in template.php or do I have to copy the whole function or I hack the modules function?

Also I was hoping you might consider expanding the attributes to include some generic data-* options in the module.

Comments

osopolar’s picture

Status: Active » Closed (works as designed)

This already could be done implementing hook_menu_attribute_info() in your custom module. See menu_attributes.api.php for an example.

osopolar’s picture

Issue summary: View changes

posted wrong code comment target instead of toggle