function backstretch_element_validate_duration in Backstretch 7.2
Form element validation handler for elements that must be a duration.
2 string references to 'backstretch_element_validate_duration'
File
- ./
backstretch.module, line 504 - Main file for Backstretch Formatter module.
Code
function backstretch_element_validate_duration($element, &$form_state) {
$value = $element['#value'];
// A duration can be an integer or a string like 'slow' or 'fast'.
if ($value !== '' && !is_numeric($value) && intval($value) == $value && $value >= 0) {
form_error($element, t('%name must be an integer.', array(
'%name' => $element['#title'],
)));
}
}