function struct_to_plaintext in Webform view 7
Another way to flatten data readabley.
Parameters
array $structured_value: Probably an array.
Return value
string Slightly formatted version of the input.
2 calls to struct_to_plaintext()
- _webform_csv_data_view in ./
webform_view.inc - Format the submitted data of a component for CSV downloading.
- _webform_table_view in ./
webform_view.inc - Return the result of a component value for display in a table.
File
- ./
webform_view.inc, line 541 - Additional component for webform that allows views to be used as embeddable elements.
Code
function struct_to_plaintext($structured_value) {
$output = '';
if (is_array($structured_value)) {
foreach ($structured_value as $row_id => $row) {
if (!empty($row)) {
// Need to flatten arrays maybe.
foreach ($row as $field => $val) {
if (is_array($val)) {
$row[$field] = '(' . implode('|', $val) . ')';
}
}
$output .= check_plain(implode(', ', $row)) . '; ';
}
}
}
else {
// Should not get here?
$output = check_plain(print_r($structured_value, 1));
}
return $output;
}