function restful_date_time_format_element_validate in RESTful 7
Same name and namespace in other branches
- 7.2 restful.module \restful_date_time_format_element_validate()
Element validate \DateTime format function.
2 string references to 'restful_date_time_format_element_validate'
- restful_admin_settings in ./
restful.admin.inc - Menu callback; Admin settings form.
- restful_token_auth_admin_settings in modules/
restful_token_auth/ restful_token_auth.admin.inc - Menu callback; Admin settings form.
File
- ./
restful.module, line 784
Code
function restful_date_time_format_element_validate($element, &$form_state) {
$value = $element['#value'];
try {
new \DateInterval($value);
} catch (\Exception $e) {
form_error($element, t('%name must be compatible with the !link.', array(
'%name' => $element['#title'],
'!link' => l(t('\\DateInterval format'), 'http://php.net/manual/en/class.dateinterval.php'),
)));
}
}