You are here

function _webform_display_number in Webform 6.3

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

Implements _webform_display_component().

File

components/number.inc, line 372
Webform module number component.

Code

function _webform_display_number($component, $value, $format = 'html') {
  $empty = !isset($value[0]) || $value[0] === '';
  return array(
    '#title' => $component['name'],
    '#weight' => $component['weight'],
    '#theme' => 'webform_display_number',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
      'webform_element_wrapper',
    ) : array(
      'webform_element_text',
    ),
    '#post_render' => array(
      'webform_element_wrapper',
    ),
    '#field_prefix' => $empty ? '' : $component['extra']['field_prefix'],
    '#field_suffix' => $empty ? '' : $component['extra']['field_suffix'],
    '#format' => $format,
    '#value' => $empty ? '' : _webform_number_format($component, $value[0]),
    '#translatable' => array(
      'title',
      'field_prefix',
      'field_suffix',
    ),
  );
}