Revision 580cd817
Added by Andreas Kohlbecker almost 3 years ago
modules/cdm_dataportal/cdm_tokens/cdm_tokens.module | ||
---|---|---|
23 | 23 |
$info = array(); |
24 | 24 |
|
25 | 25 |
$info['tokens']['cdm']['taxon_name'] = t('The taxon name consisting of all name parts and sub species rank. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page)'); |
26 |
$info['tokens']['cdm']['taxon_name:uninomial'] = t('The taxon names uninomial or genus name. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page)'); |
|
26 |
$info['tokens']['cdm']['taxon_name:genus_or_uninomial'] = t('The taxon names uninomial or genus name. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page)'); |
|
27 |
$info['tokens']['cdm']['taxon_name:family'] = t('The family name. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page)'); |
|
28 |
$info['tokens']['cdm']['taxon_name:genus'] = t('The genus name. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page)'); |
|
29 |
$info['tokens']['cdm']['taxon_name:infrageneric_epithet'] = t('The genus name. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page)'); |
|
27 | 30 |
$info['tokens']['cdm']['taxon_name:epithet'] = t('The taxon names specific epithet. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page'); |
28 | 31 |
$info['tokens']['cdm']['taxon_name:infraspecific_epithet'] = t('The taxon names specific epithet. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page'); |
29 | 32 |
$info['tokens']['cdm']['taxon_name:reference'] = t('The taxon name nomenclatural reference. (Only present on a cdm_dataportal/taxon/ or cdm_dataportal/name/* page'); |
... | ... | |
49 | 52 |
$replacements[$original] = $token_values['taxon_name']; |
50 | 53 |
} |
51 | 54 |
break; |
52 |
case 'taxon_name:uninomial': |
|
55 |
case 'taxon_name:genus_or_uninomial': |
|
56 |
case 'taxon_name:family': |
|
57 |
case 'taxon_name:genus': |
|
58 |
case 'taxon_name:infrageneric_epithet': |
|
53 | 59 |
case 'taxon_name:epithet': |
54 | 60 |
case 'taxon_name:infraspecific_epithet': |
55 |
case 'taxon_name:rank': |
|
56 | 61 |
case 'taxon_name:reference': |
57 | 62 |
case 'taxon_name:authorship': |
63 |
case 'taxon_name:rank': |
|
58 | 64 |
if($token_values[$name]){ |
59 | 65 |
$replacements[$original] = $token_values[$name]; |
60 | 66 |
} |
... | ... | |
73 | 79 |
if(!isset($current_token_values)){ |
74 | 80 |
$current_token_values = [ |
75 | 81 |
'taxon_name' => null, |
76 |
'uninomial' => null, |
|
77 |
'epithet' => null, |
|
78 |
'infraspecific_epithet' => null, |
|
79 |
'rank' => null, |
|
80 |
'reference' => null, |
|
81 |
// 'reference:doi' => null, |
|
82 |
'authorship' => null |
|
82 |
|
|
83 |
'taxon_name:genus_or_uninomial' => null, |
|
84 |
'taxon_name:family' => null, |
|
85 |
'taxon_name:genus' => null, |
|
86 |
'taxon_name:infrageneric_epithet' => null, |
|
87 |
'taxon_name:epithet' => null, |
|
88 |
'taxon_name:infraspecific_epithet' => null, |
|
89 |
'taxon_name:rank' => null, |
|
90 |
'taxon_name:reference' => null, |
|
91 |
// 'taxon_name:reference:doi' => null, |
|
92 |
'taxon_name:authorship' => null |
|
83 | 93 |
]; |
84 | 94 |
$taxon_name = null; |
85 | 95 |
|
... | ... | |
96 | 106 |
} |
97 | 107 |
|
98 | 108 |
if(isset_not_empty($taxon_name)){ |
99 |
$current_token_values['taxon_name'] = $taxon_name->nameCache; |
|
100 |
$current_token_values['uninomial'] = $taxon_name->genusOrUninomial; |
|
101 |
$current_token_values['epithet'] = $taxon_name->specificEpithet; |
|
102 |
$current_token_values['infraspecific_epithet'] = $taxon_name->infraSpecificEpithet; |
|
103 |
if(isset_not_empty($taxon_name->rank->representation_L10n)) { |
|
104 |
$current_token_values['rank'] = $taxon_name->rank->representation_L10n; |
|
109 |
$current_token_values['taxon_name:taxon_name'] = $taxon_name->nameCache; |
|
110 |
$current_token_values['taxon_name:family'] = $taxon_name->rank->isFamily ? $taxon_name->genusOrUninomial : null; |
|
111 |
$current_token_values['taxon_name:genus_or_uninomial'] = $taxon_name->genusOrUninomial; |
|
112 |
$current_token_values['taxon_name:genus'] = !$taxon_name->rank->isSupraGeneric ? $taxon_name->genusOrUninomial : null; |
|
113 |
$current_token_values['taxon_name:infrageneric_epithet'] = $taxon_name->rank->isInfraGeneric ? $taxon_name->infraGenericEpithet : null; |
|
114 |
$current_token_values['taxon_name:epithet'] = $taxon_name->rank->isSpecies || $taxon_name->rank->isInfraSpecific ? $taxon_name->specificEpithet : null; |
|
115 |
$current_token_values['taxon_name:infraspecific_epithet'] = $taxon_name->rank->isInfraSpecific ? $taxon_name->infraSpecificEpithet : null; |
|
116 |
if(@isset_not_empty($taxon_name->rank->representation_L10n)) { |
|
117 |
$current_token_values['taxon_name:rank'] = $taxon_name->rank->representation_L10n; |
|
105 | 118 |
} |
106 |
if(isset_not_empty($taxon_name->nomenclaturalSource->citation->titleCache)) { |
|
107 |
$current_token_values['reference'] = $taxon_name->nomenclaturalSource->citation->titleCache; |
|
119 |
if(@isset_not_empty($taxon_name->nomenclaturalSource->citation->titleCache)) {
|
|
120 |
$current_token_values['taxon_name:reference'] = $taxon_name->nomenclaturalSource->citation->titleCache;
|
|
108 | 121 |
} |
109 |
if(isset_not_empty($taxon_name->nomenclaturalSource->citation->authorship->titleCache)) { |
|
110 |
$current_token_values['authorship'] = $taxon_name->nomenclaturalSource->citation->authorship->titleCache; |
|
122 |
if(@isset_not_empty($taxon_name->nomenclaturalSource->citation->authorship->titleCache)) {
|
|
123 |
$current_token_values['taxon_name:authorship'] = $taxon_name->nomenclaturalSource->citation->authorship->titleCache;
|
|
111 | 124 |
} |
112 | 125 |
} |
113 | 126 |
} |
Also available in: Unified diff
ref #9666 more cdm:taxon_name tokens