function mostpopular_service_config_form_validate_throttle in Drupal Most Popular 6
Validates the throttle field in config forms.
1 string reference to 'mostpopular_service_config_form_validate_throttle'
File
- ./
mostpopular.admin.inc, line 616 - Defines all the administration forms for the Most Popular module.
Code
function mostpopular_service_config_form_validate_throttle($element, &$form_state) {
$value = $element['#value'];
$value = trim($value);
// If the value is not empty, try to convert it with strtotime()
if (!empty($value)) {
$ts = strtotime($value);
// Is the user's input a valid time interval?
if ($ts === FALSE) {
form_error($element, t("You must specify the interval in a format that can be understood by <a href='@strtotime' target='php'>strtotime()</a>.", array(
'@strtotime' => 'http://php.net/manual/en/function.strtotime.php',
)));
}
elseif ($ts <= time()) {
form_error($element, t('You must specify the time as a positive interval relative to the current time.'));
}
}
}