You are here

function theme_webform_display_time in Webform 7.4

Same name and namespace in other branches
  1. 6.3 components/time.inc \theme_webform_display_time()
  2. 7.3 components/time.inc \theme_webform_display_time()

Format the output of data for this component.

1 theme call to theme_webform_display_time()
_webform_display_time in components/time.inc
Implements _webform_display_component().

File

components/time.inc, line 392
Webform module time component.

Code

function theme_webform_display_time($variables) {
  $element = $variables['element'];
  $output = ' ';
  if (isset($element['#value']['hour']) && $element['#value']['hour'] !== '' && isset($element['#value']['minute']) && $element['#value']['minute'] !== '') {
    if ($element['#hourformat'] == '24-hour') {
      $output = sprintf('%02d', $element['#value']['hour']) . ':' . sprintf('%02d', $element['#value']['minute']);
    }
    else {
      $output = $element['#value']['hour'] . ':' . sprintf('%02d', $element['#value']['minute']) . ' ' . $element['#value']['ampm'];
    }
  }
  return $output;
}