You are here

function i18n_menu_translated_menu_link_alter in Internationalization 7

Implements hook_translated_menu_link_alter().

Translate localizable menu links on the fly. Filter out items that have a different language from current interface.

See also

i18n_menu_menu_link_alter()

File

i18n_menu/i18n_menu.module, line 322
Internationalization (i18n) submodule: Menu translation.

Code

function i18n_menu_translated_menu_link_alter(&$item) {

  // Only process links to be displayed not processed before by i18n_menu.
  if (_i18n_menu_link_process($item)) {
    if (!_i18n_menu_link_is_visible($item)) {
      $item['hidden'] = TRUE;
    }
    elseif (_i18n_menu_link_is_localizable($item)) {

      // Item has undefined language, it is a candidate for localization.
      _i18n_menu_link_localize($item);
    }
  }
}