mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
7122e1fde7
commit
30725916db
@ -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)) . "\"";
|
||||||
|
Loading…
Reference in New Issue
Block a user