Skip to content

Instantly share code, notes, and snippets.

@com2
Created February 18, 2016 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save com2/cda5bb57d2adf8cc3bbd to your computer and use it in GitHub Desktop.
Save com2/cda5bb57d2adf8cc3bbd to your computer and use it in GitHub Desktop.
function myextension_civicrm_customFieldOptions ($fieldID, &$options, $detailedFormat ) {
if ( $fieldID == 51 || $fieldID == 52 || $fieldID == 53 ) {
$result = civicrm_api3('OptionValue', 'get', array(
'return' => "label,name,value",
'option_group_id' => "languages",
'is_active' => 1,
'options' => array('sort' => "weight", 'limit' => 0),
));
$detailed_options=$result['values'];
if (isset($detailed_options) && !$detailedFormat ) {
foreach ($detailed_options AS $key => $choice) {
$options[$choice['value']] = $choice['label'];
}
} else {
$options += $detailed_options;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment