1 language.admin.inc | language_admin_add_custom_form_validate($form, &$form_state) |
Validate the language addition form on custom language button.
File
- core/
modules/ language/ language.admin.inc, line 257 - Admin page callbacks for the Language module.
Code
function language_admin_add_custom_form_validate($form, &$form_state) {
if ($form_state['values']['predefined_langcode'] == 'custom') {
$langcode = $form_state['values']['langcode'];
// Reuse the editing form validation routine if we add a custom language.
language_admin_edit_form_validate($form, $form_state);
$languages = language_list();
if (isset($languages[$langcode])) {
form_set_error('langcode', t('The language %language (%langcode) already exists.', array('%language' => $languages[$langcode]->name, '%langcode' => $langcode)));
}
}
else {
form_set_error('predefined_langcode', t('Use the <em>Add language</em> button to save a predefined language.'));
}
}