function media_watermark_form_validate in Media watermark 7
Form validation handler for media_watermark_form().
See also
File
- includes/
media_watermark_add.admin.inc, line 85 - Media watermark module integration.
Code
function media_watermark_form_validate(&$form, &$form_state) {
if (isset($form_state['values']['watermark_image'])) {
// Name validation.
if (is_string($form_state['values']['name']) && strlen($form_state['values']['name']) > 255) {
form_set_error('name', t('Too long name, it should be less then or equal to 255 character.'));
}
// Hor margin validation.
if (!is_numeric($form_state['values']['hor_margin'])) {
form_set_error('hor_margin', t('Horizontal margin, should be numeric.'));
}
elseif (strlen($form_state['values']['hor_margin']) > 20) {
form_set_error('hor_margin', t('Too long horizontal margin, it should be less then or equal to 20 digits.'));
}
// Ver margin validation.
if (!is_numeric($form_state['values']['ver_margin'])) {
form_set_error('ver_margin', t('Vertical margin, should be numeric.'));
}
elseif (strlen($form_state['values']['ver_margin']) > 20) {
form_set_error('ver_margin', t('Too long vertical margin, it should be less then or equal to 20 digits.'));
}
}
}