From daf9d55ecb8979a03ad2d921f6a6cdc153eb7464 Mon Sep 17 00:00:00 2001 From: Hayden Shaw Date: Thu, 19 Sep 2019 08:35:25 +1200 Subject: [PATCH] Allow non summary fields to be used as export fields Fixes regression in https://github.com/silverstripe/silverstripe-framework/commit/3d989a6eae979f2671889376179dfdc7085658ac. --- src/Forms/GridField/GridFieldExportButton.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Forms/GridField/GridFieldExportButton.php b/src/Forms/GridField/GridFieldExportButton.php index eb8698b72..02b6a6c87 100644 --- a/src/Forms/GridField/GridFieldExportButton.php +++ b/src/Forms/GridField/GridFieldExportButton.php @@ -216,6 +216,9 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP /** @var GridFieldDataColumns|null $gridFieldColumnsComponent */ $gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); + $columnsHandled = ($gridFieldColumnsComponent) + ? $gridFieldColumnsComponent->getColumnsHandled($gridField) + : []; /** @var DataObject $item */ foreach ($items->limit(null) as $item) { @@ -231,7 +234,7 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP } $value = $columnHeader($relObj); - } elseif ($gridFieldColumnsComponent) { + } elseif ($gridFieldColumnsComponent && array_key_exists($columnSource, $columnsHandled)) { $value = strip_tags( $gridFieldColumnsComponent->getColumnContent($gridField, $item, $columnSource) );