diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 99b2bdc5f3a9..ac378d88f7c5 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1333,6 +1333,9 @@ protected function getApiAction() { if ($action & (CRM_Core_Action::VIEW + CRM_Core_Action::BROWSE + CRM_Core_Action::BASIC + CRM_Core_Action::ADVANCED + CRM_Core_Action::PREVIEW)) { return 'get'; } + if ($action & (CRM_Core_Action::DELETE)) { + return 'delete'; + } // If you get this exception try adding more cases above. throw new Exception("Cannot determine api action for " . get_class($this) . '.' . 'CRM_Core_Action "' . CRM_Core_Action::description($action) . '" not recognized.'); } diff --git a/CRM/Core/Form/EntityFormTrait.php b/CRM/Core/Form/EntityFormTrait.php index 102393d4b569..6693f88dfafe 100644 --- a/CRM/Core/Form/EntityFormTrait.php +++ b/CRM/Core/Form/EntityFormTrait.php @@ -250,6 +250,10 @@ protected function setEntityFieldsMetadata() { // We can't load this field using metadata continue; } + if ($field != 'id' && $this->isDeleteContext()) { + // Delete forms don't generally present any fields to edit + continue; + } // Resolve action. if (empty($props['action'])) { $props['action'] = $this->getApiAction();