You are here

function _webform_render_signaturefield in SignatureField 7.2

Same name and namespace in other branches
  1. 6 modules/webform.inc \_webform_render_signaturefield()
  2. 7 includes/webform.inc \_webform_render_signaturefield()

Render a Webform component to be part of a form.

Parameters

$component: A Webform component array.

$value: If editing an existing submission or resuming a draft, this will contain an array of values to be shown instead of the default in the component configuration. This value will always be an array, keyed numerically for each value saved in this field.

File

includes/webform.inc, line 97
Webform module integration.

Code

function _webform_render_signaturefield($component, $value = NULL) {
  $form_item = array(
    '#type' => 'signaturefield',
    '#title' => $component['name'],
    '#required' => $component['required'],
    '#weight' => $component['weight'],
    '#color' => $component['extra']['color'],
    '#width' => $component['extra']['width'],
    '#height' => $component['extra']['height'],
    '#description' => isset($component['extra']['description']) ? webform_filter_descriptions($component['extra']['description']) : '',
    '#default_value' => $component['value'],
    '#prefix' => '<div class="form-item webform-component-' . $component['type'] . '" id="webform-component-' . $component['form_key'] . '">',
    '#suffix' => '</div>',
  );
  if (isset($value)) {
    $form_item['#default_value'] = $value[0];
  }
  return $form_item;
}