Skip to content

Commit

Permalink
dev/core#715 - Fix delete action on RelationshipType form
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Feb 12, 2019
1 parent df09643 commit 50e3ab2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CRM/Core/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down
4 changes: 4 additions & 0 deletions CRM/Core/Form/EntityFormTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 50e3ab2

Please sign in to comment.