FIX Array to string conversion message after CSV export (#6622)

* FIX Array to string conversion message after CSV export

* Removed invalid line endings
This commit is contained in:
Juan van den Anker 2017-02-16 11:20:00 +13:00 committed by Daniel Hensby
parent 7122e1fde7
commit 30725916db

View File

@ -110,8 +110,13 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
// determine the CSV headers. If a field is callable (e.g. anonymous function) then use the // determine the CSV headers. If a field is callable (e.g. anonymous function) then use the
// source name as the header instead // source name as the header instead
foreach($csvColumns as $columnSource => $columnHeader) { foreach($csvColumns as $columnSource => $columnHeader) {
$headers[] = (!is_string($columnHeader) && is_callable($columnHeader)) ? $columnSource : $columnHeader; if (is_array($columnHeader) && array_key_exists('title', $columnHeader)) {
$headers[] = $columnHeader['title'];
} else {
$headers[] = (!is_string($columnHeader) && is_callable($columnHeader)) ? $columnSource : $columnHeader;
}
} }
$fileData .= "\"" . implode("\"{$separator}\"", array_values($headers)) . "\""; $fileData .= "\"" . implode("\"{$separator}\"", array_values($headers)) . "\"";