删除 scaffolded GridField 以获取关系
class MyDataObject extends DataObject {
...
private static $has_many = array(
'OtherDataObjects' => 'OtherDataObject'
);
function getCMSFields() {
$fields = parent::getCMSFields();
if ($gridField = $fields->dataFieldByName('OtherDataObjects')) {
$gridField->getConfig()
->removeComponentsByType('GridFieldExportButton');
}
return $fields;
}
}