You are here

function _webform_table_data_grid in Webform 6.2

Same name and namespace in other branches
  1. 5.2 components/grid.inc \_webform_table_data_grid()
  2. 5 components/grid.inc \_webform_table_data_grid()

function _webform_table_data_select Return the result of this component's submission for display in a table. The output of this function will be displayed under the "results" tab then "table"

@returns Textual output formatted for human reading.

Parameters

$data An array of information containing the submission result, directly correlating to the webform_submitted_data database schema:

File

components/grid.inc, line 307
Webform module grid component.

Code

function _webform_table_data_grid($data, $component) {
  $questions = array_values(_webform_grid_options($component['extra']['questions']));
  $output = '';

  // Set the value as a single string.
  if (is_array($data['value'])) {
    foreach ($data['value'] as $item => $value) {
      if ($value !== '') {
        $output .= $questions[$item] . ': ' . check_plain($value) . '<br />';
      }
    }
  }
  else {
    $output = check_plain(!isset($data['value']['0']) ? '' : $data['value']['0']);
  }
  return $output;
}