Skip to content

Commit

Permalink
Merge pull request #12440 from mattwire/customfield_selectnooptiongroup
Browse files Browse the repository at this point in the history
dev/core#244 Allow use of custom fields of type select without specifying an optiongroup
  • Loading branch information
eileenmcnaughton authored Jul 24, 2018
2 parents 0d7f958 + 6c5d3fc commit 8c70172
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ public function getOptions($context = NULL) {
$this->find(TRUE);
}

// This will hold the list of options in format key => label
$options = [];

if (!empty($this->option_group_id)) {
$options = CRM_Core_OptionGroup::valuesByID(
$this->option_group_id,
Expand All @@ -421,9 +424,6 @@ public function getOptions($context = NULL) {
elseif ($this->data_type === 'Boolean') {
$options = $context == 'validate' ? array(0, 1) : CRM_Core_SelectValues::boolean();
}
else {
return FALSE;
}
CRM_Utils_Hook::customFieldOptions($this->id, $options, FALSE);
CRM_Utils_Hook::fieldOptions($this->getEntity(), "custom_{$this->id}", $options, array('context' => $context));
return $options;
Expand Down

0 comments on commit 8c70172

Please sign in to comment.