Fixes printing from crashing

This commit is contained in:
Christopher Joe 2017-06-02 16:39:14 +12:00 committed by Damian Mooyman
parent 44f27645bd
commit d12c986dd5
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A

View File

@ -4,6 +4,7 @@ namespace SilverStripe\Forms\GridField;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Core\Extensible;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
@ -17,6 +18,7 @@ use SilverStripe\View\ArrayData;
*/ */
class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionProvider, GridField_URLHandler class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionProvider, GridField_URLHandler
{ {
use Extensible;
/** /**
* @var array Map of a property name on the printed objects, with values * @var array Map of a property name on the printed objects, with values
@ -46,6 +48,7 @@ class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionPr
{ {
$this->targetFragment = $targetFragment; $this->targetFragment = $targetFragment;
$this->printColumns = $printColumns; $this->printColumns = $printColumns;
$this->constructExtensions();
} }
/** /**
@ -124,9 +127,12 @@ class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionPr
{ {
set_time_limit(60); set_time_limit(60);
Requirements::clear(); Requirements::clear();
Requirements::css(ltrim(FRAMEWORK_DIR . '/admin/client/dist/styles/GridField_print.css', '/'));
if ($data = $this->generatePrintData($gridField)) { $data = $this->generatePrintData($gridField);
$this->extend('updatePrintData', $data);
if ($data) {
return $data->renderWith(get_class($gridField)."_print"); return $data->renderWith(get_class($gridField)."_print");
} }