Revision 2b9108d4
Added by Andreas Kohlbecker over 12 years ago
5.x/modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
627 | 627 |
return cdm_Vocabulary_as_option(UUID_RANK); |
628 | 628 |
} |
629 | 629 |
|
630 |
function cdm_Vocabulary_as_option($vocabularyUuid){ |
|
630 |
function cdm_Vocabulary_as_option($vocabularyUuid, $term_label_callback = null){
|
|
631 | 631 |
static $vocabularyOptions; |
632 | 632 |
|
633 | 633 |
if(!$rankVocabularyOptions){ |
... | ... | |
637 | 637 |
$vocabularyOptions[$vocabularyUuid] = array(); |
638 | 638 |
if($vocab){ |
639 | 639 |
foreach($vocab->terms as $term){ |
640 |
$vocabularyOptions[$vocabularyUuid][$term->uuid] = t($term->representation_L10n); |
|
640 |
if($term_label_callback && function_exists($term_label_callback)){ |
|
641 |
$vocabularyOptions[$vocabularyUuid][$term->uuid] = call_user_func($term_label_callback, $term); |
|
642 |
} else { |
|
643 |
$vocabularyOptions[$vocabularyUuid][$term->uuid] = t($term->representation_L10n); |
|
644 |
} |
|
641 | 645 |
} |
642 | 646 |
array_reverse($vocabularyOptions[$vocabularyUuid]); |
643 | 647 |
} |
... | ... | |
646 | 650 |
return $vocabularyOptions[$vocabularyUuid]; |
647 | 651 |
} |
648 | 652 |
|
653 |
function _cdm_relationship_type_term_label_callback($term){ |
|
654 |
if(isset($term->representation_L10n_abbreviatedLabel)) { |
|
655 |
return $term->representation_L10n_abbreviatedLabel . ' : ' . t($term->representation_L10n); |
|
656 |
} else { |
|
657 |
return t($term->representation_L10n); |
|
658 |
} |
|
659 |
} |
|
660 |
|
|
649 | 661 |
|
650 | 662 |
function cdm_ws_descriptions_by_featuretree($featureTree, $descriptions, $isDescriptionsSeparated = false){ |
651 | 663 |
|
5.x/modules/cdm_dataportal/settings.php | ||
---|---|---|
867 | 867 |
'#description' => t('If this option is enabled the synonymy will show the below selected taxon relationships of accepted taxa.') |
868 | 868 |
); |
869 | 869 |
|
870 |
$taxonRelationshipTypeOptions = cdm_Vocabulary_as_option(UUID_TAXON_RELATIONSHIP_TYPE);
|
|
870 |
$taxonRelationshipTypeOptions = cdm_Vocabulary_as_option(UUID_TAXON_RELATIONSHIP_TYPE, _cdm_relationship_type_term_label_callback);
|
|
871 | 871 |
$form['synonymy'][CDM_TAXON_RELATIONSHIP_TYPES] = array( |
872 | 872 |
'#type' => 'checkboxes', |
873 | 873 |
'#title' => t('Taxon relationship types'), |
Also available in: Unified diff
using abbreviated label for taxon relationships also in setting page (fixes one problem in #2609)