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. * Export core.
*/ */
public function generatePrintData($gridField) { public function generatePrintData($gridField) {
$printColumns = ($this->printColumns) if($this->printColumns) {
? $this->printColumns $printColumns = $this->printColumns;
: singleton($gridField->getModelClass())->summaryFields(); } else if($dataCols = $gridField->getConfig()->getComponentByType('GridFieldDataColumns')) {
$printColumns = $dataCols->getDisplayFields($gridField);
} else {
$printColumns = singleton($gridField->getModelClass())->summaryFields();
}
$header = null; $header = null;
if($this->printHasHeader){ if($this->printHasHeader){
$header = new ArrayList(); $header = new ArrayList();