Skip to content

Commit

Permalink
Fix for issue editing custom fields with option groups after civicrm#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Aug 22, 2018
1 parent 3afc47d commit 2a8d615
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions CRM/Custom/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,21 @@ public function buildQuickForm() {
$this->freeze('data_type');
}

$optionGroupParams = [
'is_reserved' => 0,
'is_active' => 1,
'options' => ['limit' => 0, 'sort' => "title ASC"],
'return' => ['title'],
];
if ($this->_action == CRM_Core_Action::UPDATE) {
$optionGroupParams['id'] = $this->_values['id'];
$optionGroupParams = [
'id' => $this->_values['option_group_id'],
'return' => ['title'],
];
}
else {
$optionGroupParams = [
'is_reserved' => 0,
'is_active' => 1,
'options' => ['limit' => 0, 'sort' => "title ASC"],
'return' => ['title'],
];
}

// Get all custom (is_reserved=0) option groups
$optionGroupMetadata = civicrm_api3('OptionGroup', 'get', $optionGroupParams);

Expand Down

0 comments on commit 2a8d615

Please sign in to comment.