Skip to content

Instantly share code, notes, and snippets.

@com2
Created February 18, 2016 14:11

Revisions

  1. com2 created this gist Feb 18, 2016.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    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;
    }

    }
    }