You are here

function i18nmenu_menu_item_prepare_normal_path in Internationalization 6

Normal path should be checked with menu item's language to avoid troubles when a node and it's translation has the same url alias.

1 string reference to 'i18nmenu_menu_item_prepare_normal_path'
i18nmenu_form_menu_edit_item_alter in i18nmenu/i18nmenu.module
Implementation of hook_form_form_id_alter().

File

i18nmenu/i18nmenu.module, line 306
Internationalization (i18n) submodule: Menu translation.

Code

function i18nmenu_menu_item_prepare_normal_path($form, &$form_state) {
  $item =& $form_state['values']['menu'];
  $normal_path = drupal_get_normal_path($item['link_path'], $item['language']);
  if ($item['link_path'] != $normal_path) {
    drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array(
      '%link_path' => $item['link_path'],
      '%normal_path' => $normal_path,
    )));
    $item['link_path'] = $normal_path;
  }
}