function _webform_table_grid in Webform 7.4
Same name and namespace in other branches
- 6.3 components/grid.inc \_webform_table_grid()
- 7.3 components/grid.inc \_webform_table_grid()
Implements _webform_table_component().
File
- components/
grid.inc, line 573 - Webform module grid component.
Code
function _webform_table_grid($component, $value) {
$node = node_load($component['nid']);
$questions = _webform_select_options_from_text($component['extra']['questions'], TRUE);
$questions = _webform_select_replace_tokens($questions, $node);
$options = _webform_select_options_from_text($component['extra']['options'], TRUE);
$options = _webform_select_replace_tokens($options, $node);
$output = '';
// Set the value as a single string.
foreach ($questions as $key => $label) {
if (isset($value[$key]) && isset($options[$value[$key]])) {
$output .= webform_filter_xss(_webform_grid_question_header($label)) . ': ' . webform_filter_xss($options[$value[$key]]) . '<br />';
}
}
// Return output if the grid contains internal questions.
if (count($questions)) {
return $output;
}
}