ENHANCEMENT GridFieldExportButton now supports dot syntax for column sources through DataObject::relField()

This commit is contained in:
Sean Harvey 2012-03-25 19:54:38 +13:00
parent 92b6adfcb5
commit 4bcd44aee6

View File

@ -113,7 +113,7 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
foreach($items as $item) { foreach($items as $item) {
$columnData = array(); $columnData = array();
foreach($csvColumns as $columnSource => $columnHeader) { foreach($csvColumns as $columnSource => $columnHeader) {
$value = $item->$columnSource; $value = $item->relField($columnSource);
$value = str_replace(array("\r", "\n"), "\n", $value); $value = str_replace(array("\r", "\n"), "\n", $value);
$columnData[] = '"' . str_replace('"', '\"', $value) . '"'; $columnData[] = '"' . str_replace('"', '\"', $value) . '"';
} }