You are here

function _hms_pre_render_form_element in HMS Field 7

Helper function to convert seconds to a formatted value (FORM API).

1 string reference to '_hms_pre_render_form_element'
hms_field_element_info in ./hms_field.module
Implements hook_element_info().

File

./hms_field.module, line 669
Provides an hms_field functionality.

Code

function _hms_pre_render_form_element($element) {
  $value = $element['#value'] !== FALSE ? $element['#value'] : $element['#default_value'];
  if ((!empty($value) || (int) $value === 0) && is_numeric($value)) {
    $element['#value'] = _hms_seconds_to_formatted($value, $element['#format']);
  }
  return $element;
}