From 89084bb6971f50de3b5fd28d34b2505b8ffcc741 Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Tue, 18 Apr 2017 11:52:10 -0500 Subject: [PATCH] LocationAdmin - remove DeleteAction on Location --- code/admin/LocationAdmin.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/code/admin/LocationAdmin.php b/code/admin/LocationAdmin.php index 503c921..9cb8e64 100644 --- a/code/admin/LocationAdmin.php +++ b/code/admin/LocationAdmin.php @@ -58,4 +58,21 @@ public function getExportFields() return parent::getExportFields(); } + + /** + * @param null $id + * @param null $fields + * @return $this|Form + */ + public function getEditForm($id = null, $fields = null) + { + $form = parent::getEditForm($id, $fields); + $class = $this->sanitiseClassName($this->modelClass); + if ($class == 'Location') { + $gridField = $form->Fields()->fieldByName($class); + $config = $gridField->getConfig(); + $config->removeComponentsByType('GridFieldDeleteAction'); + } + return $form; + } }