mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Allow non summary fields to be used as grid field export fields (#9248)
Allow non summary fields to be used as grid field export fields
This commit is contained in:
commit
109ac3f75f
@ -216,6 +216,9 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
|
|||||||
|
|
||||||
/** @var GridFieldDataColumns|null $gridFieldColumnsComponent */
|
/** @var GridFieldDataColumns|null $gridFieldColumnsComponent */
|
||||||
$gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);
|
$gridFieldColumnsComponent = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);
|
||||||
|
$columnsHandled = ($gridFieldColumnsComponent)
|
||||||
|
? $gridFieldColumnsComponent->getColumnsHandled($gridField)
|
||||||
|
: [];
|
||||||
|
|
||||||
/** @var DataObject $item */
|
/** @var DataObject $item */
|
||||||
foreach ($items->limit(null) as $item) {
|
foreach ($items->limit(null) as $item) {
|
||||||
@ -231,7 +234,7 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
|
|||||||
}
|
}
|
||||||
|
|
||||||
$value = $columnHeader($relObj);
|
$value = $columnHeader($relObj);
|
||||||
} elseif ($gridFieldColumnsComponent) {
|
} elseif ($gridFieldColumnsComponent && array_key_exists($columnSource, $columnsHandled)) {
|
||||||
$value = strip_tags(
|
$value = strip_tags(
|
||||||
$gridFieldColumnsComponent->getColumnContent($gridField, $item, $columnSource)
|
$gridFieldColumnsComponent->getColumnContent($gridField, $item, $columnSource)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user