function _hms_value_callback in HMS Field 7
Helper function to convert input values to seconds (FORM API).
1 string reference to '_hms_value_callback'
- hms_field_element_info in ./
hms_field.module - Implements hook_element_info().
File
- ./
hms_field.module, line 653 - Provides an hms_field functionality.
Code
function _hms_value_callback($element, $input = NULL, $form_state) {
if ($form_state['process_input'] && (!empty($input) || $input === 0)) {
$seconds = _hms_formatted_to_seconds($input, $element['#format']);
// If seconds are 0 return string instead of integer.
if ($seconds == 0) {
return '0';
}
return $seconds;
}
return $input;
}