gridField = $gridField; return array( 'header' => $gridField->customise(array( 'NewLink' => Controller::join_links($gridField->Link('item'), 'new'), 'NewEnabled' => $this->getNewEnabled() ))->renderWith('GridFieldToolbarHeader') ); } /** * Returns whether or not the "add new" button will appear when rendering this DataGrid title * @return bool */ public function getNewEnabled() { if($this->gridField) { $model = singleton($this->gridField->getModelClass()); if(!$model->canCreate()) { return false; } } return $this->newEnabled; } /** * Enable or disable the "add new" button to add new DataGrid object instances * @param $enabled */ public function setNewEnabled($enabled) { $this->newEnabled = $enabled; } }