You are here

function _webform_display_file in Webform 7.4

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

Implements _webform_display_component().

File

components/file.inc, line 449
Webform module file component.

Code

function _webform_display_file($component, $value, $format = 'html', $submission = array()) {
  $fid = isset($value[0]) ? $value[0] : NULL;
  return array(
    '#title' => $component['name'],
    '#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
    '#value' => $fid ? webform_get_file($fid) : NULL,
    '#weight' => $component['weight'],
    '#theme' => 'webform_display_file',
    '#theme_wrappers' => $format == 'text' ? array(
      'webform_element_text',
    ) : array(
      'webform_element',
    ),
    '#format' => $format,
    '#translatable' => array(
      'title',
    ),
  );
}