function i18n_menu_translation_form_validate in Internationalization 7
Process form validation
File
- i18n_menu/
i18n_menu.admin.inc, line 67 - Helper functions for menu administration.
Code
function i18n_menu_translation_form_validate($form, &$form_state) {
if ($form_state['values']['op'] == t('Save')) {
$selected = 0;
// example array('en' => 'navigation:0')
$mlids = array_filter($form_state['values']['translations']);
foreach ($mlids as $lang => $item_name) {
list($menu_name, $mlid) = explode(':', $item_name);
if ($mlid && ($item = menu_link_load($mlid)) && i18n_object_langcode($item)) {
$selected++;
}
else {
unset($form_state['values']['translations'][$lang]);
}
}
if ($selected < 1) {
form_set_error('translations', t('There are no translations to save.'));
}
}
}