function i18nmenu_form_menu_edit_item_alter in Internationalization 6
Implementation of hook_form_form_id_alter().
Add a language selector to the menu_edit_item form and register a submit callback to process items.
File
- i18nmenu/
i18nmenu.module, line 284 - Internationalization (i18n) submodule: Menu translation.
Code
function i18nmenu_form_menu_edit_item_alter(&$form, $form_state) {
if ($form['menu']['#item'] && isset($form['menu']['#item']['options']['langcode'])) {
$language = $form['menu']['#item']['options']['langcode'];
}
else {
$language = '';
}
$form['menu']['language'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#description' => t('Select a language for this menu item. Choose "All languages" to make the menu item translatable into different languages.'),
'#options' => array(
'' => t('All languages'),
) + locale_language_list('name'),
'#default_value' => $language,
);
array_unshift($form['#validate'], 'i18nmenu_menu_item_prepare_normal_path');
$form['#submit'][] = 'i18nmenu_menu_item_update';
}