_webform_render_file

Versions
5 – 6
_webform_render_file($component)
7
_webform_render_file($component, $value = NULL)

Build a form item array containing all the properties of this component.

Parameters

$component An array of information describing the component, directly correlating to the webform_component database schema.

Return value

An array of a form item to be displayed on the client-side webform.

▾ 1 function calls _webform_render_file()

_webform_submission_display_file in contributions/webform/components/file.inc
Display the result of a file submission. The output of this function will be displayed under the "results" tab then "submissions".

Code

contributions/webform/components/file.inc, line 180

<?php
function _webform_render_file($component) {
  $form_item = array(
    '#type'          => $component['type'],
    '#title'         => $component['name'],
    //'#required'      => $component['mandatory'], // Drupal core bug with required file uploads
    '#weight'        => $component['weight'],
    '#description'   => _webform_filtervalues($component['extra']['description']),
    '#attributes'    => $component['extra']['attributes'],
    '#tree'          => false, // file_check_upload assumes a flat $_FILES structure.
    '#validate'      => array(
      '_webform_validate_file' => array($component['form_key'], $component['name'], $component['extra']['filtering']),
      '_webform_required_file' => array($component['form_key'], $component['name'], $component['mandatory']), // Custom required routine.
    ),
    '#prefix'        => '<div class="webform-component-'. $component['type'] .'" id="webform-component-'. $component['form_key'] .'">',
    '#suffix'        => '</div>',
  );

  return $form_item;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.