function styleswitcher_style_form_validate in Style Switcher 7.2
Same name and namespace in other branches
- 6.2 styleswitcher.admin.inc \styleswitcher_style_form_validate()
Form validation handler for styleswitcher_style_form().
See also
styleswitcher_style_form_submit()
File
- ./
styleswitcher.admin.inc, line 260 - Styleswitcher configuration functionality.
Code
function styleswitcher_style_form_validate($form, &$form_state) {
// Trim text values now, so submission handlers get them fully validated.
// No need to trim name, because it's validated by a machine-name pattern.
form_set_value($form['label'], trim($form_state['values']['label']), $form_state);
$path = $form_state['values']['path'];
if ($path === '') {
// Set the path back to NULL.
form_set_value($form['path'], NULL, $form_state);
}
else {
$path = trim($path);
form_set_value($form['path'], $path, $form_state);
if (!is_file($path) && !url_is_external($path)) {
form_set_error('path', t('Stylesheet file %path does not exist.', array(
'%path' => $path,
)));
}
}
}