You are here

function _webform_display_signaturefield in SignatureField 7.2

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

Display the result of a submission for a component.

The output of this function will be displayed under the "Results" tab then "Submissions". This should output the saved data in some reasonable manner.

Parameters

$component: A Webform component array.

$value: An array of information containing the submission result, directly correlating to the webform_submitted_data database table schema.

$format: Either 'html' or 'text'. Defines the format that the content should be returned as. Make sure that returned content is run through check_plain() or other filtering functions when returning HTML.

Return value

A renderable element containing at the very least these properties:

  • #title
  • #weight
  • #component
  • #format
  • #value

Webform also uses #theme_wrappers to output the end result to the user, which will properly format the label and content for use within an e-mail (such as wrapping the text) or as HTML (ensuring consistent output).

File

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

Code

function _webform_display_signaturefield($component, $value, $format = 'html') {
  return array(
    '#title' => $component['name'],
    '#weight' => $component['weight'],
    '#markup' => theme('signaturefield_display', array(
      'data' => $value['0'],
      'settings' => array(
        'color' => $component['extra']['color'],
        'width' => $component['extra']['width'],
        'height' => $component['extra']['height'],
      ),
    )),
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
    ) : array(
      'webform_element_text',
    ),
    '#post_render' => array(
      'webform_element_wrapper',
    ),
    '#component' => $component,
    '#format' => $format,
    '#value' => isset($value[0]) ? $value[0] : '',
  );
}