+ if (!empty($customField->option_group_id)) {
+ $options = CRM_Core_OptionGroup::valuesByID($customField->option_group_id,
+ $flip,
+ $params['grouping'],
+ $params['localize'],
+ // Note: for custom fields the 'name' column is NULL
+ CRM_Utils_Array::value('labelColumn', $params, 'label'),
+ $params['onlyActive'],
+ $params['fresh']
+ );
+ }
+ else {
+ if ($customField->data_type === 'StateProvince') {
+ $options = self::stateProvince();
+ }
+ elseif ($customField->data_type === 'Country') {
+ $options = $context == 'validate' ? self::countryIsoCode() : self::country();
+ }
+ elseif ($customField->data_type === 'Boolean') {
+ $options = $context == 'validate' ? array(0, 1) : array(1 => ts('Yes'), 0 => ts('No'));
+ }
+ $options = $options && $flip ? array_flip($options) : $options;
+ }
+ if ($options !== FALSE) {
+ CRM_Utils_Hook::customFieldOptions($customField->id, $options, FALSE);
+ }
+ $customField->free();