Respect displayFields in GridFieldPrintButton

Provides more coherent and expected default behaviour
This commit is contained in:
Ingo Schommer 2013-01-14 16:32:31 +01:00
parent 703c10aa0e
commit 80feb8c0b4

View File

@ -91,9 +91,14 @@ class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionPr
* Export core.
*/
public function generatePrintData($gridField) {
$printColumns = ($this->printColumns)
? $this->printColumns
: singleton($gridField->getModelClass())->summaryFields();
if($this->printColumns) {
$printColumns = $this->printColumns;
} else if($dataCols = $gridField->getConfig()->getComponentByType('GridFieldDataColumns')) {
$printColumns = $dataCols->getDisplayFields($gridField);
} else {
$printColumns = singleton($gridField->getModelClass())->summaryFields();
}
$header = null;
if($this->printHasHeader){
$header = new ArrayList();