function theme_webform_display_view in Webform view 7.4
Same name and namespace in other branches
- 7 webform_view.inc \theme_webform_display_view()
Format the output of data for this component.
This renders the data that's been submitted. As seen on the results pages, also used for the email.
1 theme call to theme_webform_display_view()
- _webform_display_view in ./
webform_view.inc - Implements _webform_display_component().
File
- ./
webform_view.inc, line 399 - Additional component for webform that allows views to be used as embeddable elements.
Code
function theme_webform_display_view($variables) {
$element = $variables['element'];
// May need to unpack and flatten nested arrays (multiple checkbox options).
foreach ($element['#value'] as $delta => $row) {
foreach ($row as $col => $cell) {
// Some fields may be so arrive as arrays. Stringify when theming.
if (is_array($cell)) {
$element['#value'][$delta][$col] = implode(', ', $cell);
}
}
}
// Theme the order like a table.
if ($element['#format'] == 'html') {
$first_row = reset($element['#value']);
$header = array();
if ($first_row) {
foreach ($first_row as $key => $val) {
$header[] = t($element[$key]['#title']);
}
}
return theme('table', array(
'header' => $header,
'rows' => $element['#value'],
));
}
else {
return array_to_plaintext_table($element['#value']);
}
}