function _webform_csv_data_matrix in Webform Matrix Component 7.4
Same name and namespace in other branches
- 6 components/matrix.inc \_webform_csv_data_matrix()
- 7 components/matrix.inc \_webform_csv_data_matrix()
- 7.2 components/matrix.inc \_webform_csv_data_matrix()
- 7.3 components/matrix.inc \_webform_csv_data_matrix()
Implements _webform_csv_data_component().
File
- components/
matrix.inc, line 705 - Webform module matrix component.
Code
function _webform_csv_data_matrix($component, $export_options, $value) {
if ($value[0]) {
$value_array = _webform_matrix_component_array($value[0]);
if (empty($value_array)) {
return array_fill(0, $size, "");
}
$sub_elements = $component['extra']['element'];
//Return managable display array
$display_array = _webform_display_array($sub_elements, $value_array);
$reverse_array = _webform_matrix_component_array_reverse($display_array);
$csv_array = array();
foreach ($reverse_array as $value) {
$csv_array[] = implode(" - ", empty($value) ? "NA" : $value);
}
return $csv_array;
}
else {
return array_fill(0, $size, "");
}
}