You are here

function jquerymobile_menu_link_alter in jQuery Mobile module 7.2

Implements hook_menu_link_alter().

File

modules/menu.inc, line 154
Alterations required to the menu module.

Code

function jquerymobile_menu_link_alter(&$item, $menu) {
  global $theme_key;
  if (_jquerymobile_is_mobile_theme($theme_key)) {
    if (isset($item['options']['attributes']) && is_array($item['options']['attributes'])) {

      // Filter out blank attributes.
      foreach ($item['options']['attributes'] as $key => $value) {
        if (empty($value)) {
          unset($item['options']['attributes'][$key]);
        }
      }
    }
    if (isset($item['options']['jquerymobile_attributes']) && is_array($item['options']['jquerymobile_attributes'])) {

      // Filter out blank attributes.
      foreach ($item['options']['jquerymobile_attributes'] as $key => $value) {
        if (empty($value)) {
          unset($item['options']['jquerymobile_attributes'][$key]);
        }
      }
    }
  }
}