You are here

function _webform_display_time in Webform 6.3

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

Implements _webform_display_component().

File

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

Code

function _webform_display_time($component, $value, $format = 'html') {
  $value = webform_date_array(isset($value[0]) ? $value[0] : '', 'time');
  if ($component['extra']['hourformat'] == '12-hour') {
    $value = webform_time_convert($value, '12-hour');
  }
  return array(
    '#title' => $component['name'],
    '#weight' => $component['weight'],
    '#theme' => 'webform_display_time',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
      'webform_element_wrapper',
    ) : array(
      'webform_element_text',
    ),
    '#post_render' => array(
      'webform_element_wrapper',
    ),
    '#format' => $format,
    '#hourformat' => $component['extra']['hourformat'],
    '#value' => $value,
    '#pre_render' => array(
      'webform_element_title_display',
    ),
    '#translatable' => array(
      'title',
    ),
  );
}