function _pathauto_validate_numeric_element in Pathauto 6.2
Same name and namespace in other branches
- 6 pathauto.admin.inc \_pathauto_validate_numeric_element()
- 7 pathauto.admin.inc \_pathauto_validate_numeric_element()
Validate a form element that should have an numeric value.
1 string reference to '_pathauto_validate_numeric_element'
- pathauto_settings_form in ./
pathauto.admin.inc - Form builder; Configure the Pathauto settings.
File
- ./
pathauto.admin.inc, line 273 - Admin page callbacks for the Pathauto module.
Code
function _pathauto_validate_numeric_element($element, &$form_state) {
$value = $element['#value'];
if (!is_numeric($value)) {
form_error($element, t('The field %name is not a valid number.', array(
'%name' => $element['#title'],
)));
}
elseif (isset($element['#max_value']) && $value > $element['#max_value']) {
form_error($element, t('The field %name cannot be greater than @max.', array(
'%name' => $element['#title'],
'@max' => $element['#max_value'],
)));
}
elseif (isset($element['#min_value']) && $value < $element['#min_value']) {
form_error($element, t('The field %name cannot be less than @min.', array(
'%name' => $element['#title'],
'@min' => $element['#min_value'],
)));
}
}