You are here

function _webform_display_view in Webform view 7.4

Same name and namespace in other branches
  1. 7 webform_view.inc \_webform_display_view()

Implements _webform_display_component().

The $value available here has been flattened and serialized

  • unpack it before use.

File

./webform_view.inc, line 334
Additional component for webform that allows views to be used as embeddable elements.

Code

function _webform_display_view($component, $value_serialized, $format = 'html', $submission = array()) {
  $value = array();
  if (!empty($submission)) {
    foreach ($component['children'] as $cid => $field) {
      if ($field['type'] == 'hidden') {

        // Data is stored in the first hidden field
        $value = unserialize($submission->data[$cid][0]);
        break;
      }
    }
  }
  return array(
    '#title' => $component['name'],
    '#weight' => $component['weight'],
    '#theme' => 'webform_display_view',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
    ) : array(
      'webform_element_text',
    ),
    '#format' => $format,
    '#value' => (array) $value,
    '#translatable' => array(
      'title',
      'options',
    ),
  );
}