You are here

function _webform_display_mapping in Webform Bonus Pack 6.3

Same name and namespace in other branches
  1. 7.3 components/mapping.inc \_webform_display_mapping()

Implementation of _webform_display_component().

File

components/mapping.inc, line 148
Webform module mapping component.

Code

function _webform_display_mapping($component, $value, $format = 'html') {
  $element = array(
    '#title' => t('!name (hidden)', array(
      '!name' => $component['name'],
    )),
    '#value' => isset($value[0]) ? $value[0] : NULL,
    '#weight' => $component['weight'],
    '#theme' => 'webform_display_mapping',
    '#format' => $format,
    '#theme' => 'webform_display_mapping',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
      'webform_element_wrapper',
    ) : array(
      'webform_element_text',
    ),
    '#post_render' => array(
      'webform_element_wrapper',
    ),
    '#webform_component' => $component,
  );

  // TODO: This check is unusual. It shows hidden fields in e-mails but not
  // when viewing in the browser unless you're an administrator. This should be
  // a more logical check. See these related issues:
  // http://drupal.org/node/313639
  // http://drupal.org/node/781786
  if ($format == 'html') {
    $element['#access'] = user_access('edit all webform submissions') || user_access('access all webform results');
  }
  return $element;
}