function language_selection_page_admin_validate in Language Selection Page 7.2
Same name and namespace in other branches
- 6 language_selection_page.admin.inc \language_selection_page_admin_validate()
Validate for admin page form.
1 string reference to 'language_selection_page_admin_validate'
- language_selection_page_admin in ./
language_selection_page.admin.inc - The admin page form.
File
- ./
language_selection_page.admin.inc, line 160 - The admin page of the language selection page module.
Code
function language_selection_page_admin_validate($form, &$form_state) {
$values = $form_state['values'];
if (drupal_strlen($values['language_selection_page_path']) > 32) {
form_set_error('language_selection_page_path', 'The path is invalid. Please use a path with 32 characters or less.');
}
$candidate_path = drupal_html_class($values['language_selection_page_path']);
$candidate_path = preg_replace('/[^a-z0-9_-]+/', '', $candidate_path);
// Validate the string.
if (preg_match('/[^\\w.-]/', $values['language_selection_page_path'])) {
form_set_error('language_selection_page_path', 'The path is invalid. Please use a valid path such this example: ' . $candidate_path);
}
}