Skip to content

Instantly share code, notes, and snippets.

@dljoseph
Forked from kinglozzer/gist:8c14cfd1108ad27380f7
Created October 18, 2015 16:24
Show Gist options
  • Save dljoseph/7fdd98d3778b010e10b8 to your computer and use it in GitHub Desktop.
Save dljoseph/7fdd98d3778b010e10b8 to your computer and use it in GitHub Desktop.
<?php
class SomeModelAdmin extends ModelAdmin {
private static $managed_models = array(
"MyDataObject"
);
public function getEditForm($id = null, $fields = null) {
$form = parent::getEditForm($id, $fields);
$gridField = $form->Fields()->dataFieldByName('MyDataObject');
$detailForm = $gridField->getConfig()->getComponentByType('GridFieldDetailForm');
$detailForm->setItemEditFormCallback(function($form) use ($self) {
$form->Actions()->removeByName('action_doDelete');
});
return $form;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment