function _webform_table_component in Webform 7.4
Same name and namespace in other branches
- 6.3 webform.api.php \_webform_table_component()
- 7.3 webform.api.php \_webform_table_component()
Return the result of a component value for display in a table.
The output of this function will be displayed under the "Results" tab then "Table".
Parameters
$component: A Webform component array.
$value: An array of information containing the submission result, directly correlating to the webform_submitted_data database schema.
Return value
string Textual output formatted for human reading.
Related topics
File
- ./
webform.api.php, line 1282 - Sample hooks demonstrating usage in Webform.
Code
function _webform_table_component($component, $value) {
$questions = array_values(_webform_component_options($component['extra']['questions']));
$output = '';
// Set the value as a single string.
if (is_array($value)) {
foreach ($value as $item => $value) {
if ($value !== '') {
$output .= $questions[$item] . ': ' . check_plain($value) . '<br />';
}
}
}
else {
$output = check_plain(!isset($value['0']) ? '' : $value['0']);
}
return $output;
}