Revision e413f218
Added by Andreas Kohlbecker about 8 years ago
modules/cdm_dataportal/includes/descriptions.inc | ||
---|---|---|
925 | 925 |
} |
926 | 926 |
|
927 | 927 |
|
928 |
/** |
|
929 |
* Theme function to render CDM DescriptionElements of the type TaxonInteraction. |
|
930 |
* |
|
931 |
* @param $element |
|
932 |
* The CDM TaxonInteraction entity |
|
933 |
* |
|
934 |
* @return |
|
935 |
* A drupal render array |
|
936 |
* |
|
937 |
* @ingroup compose |
|
938 |
*/ |
|
939 |
function compose_description_element_taxon_interaction($element, $feature_block_settings) { |
|
940 |
|
|
941 |
$out = ''; |
|
942 |
$enclosing_tag = cdm_feature_block_element_tag_name($feature_block_settings); |
|
943 |
|
|
944 |
if (isset($element->description_L10n)) { |
|
945 |
$out .= ' ' . $element->description_L10n; |
|
946 |
} |
|
947 |
|
|
948 |
if(isset($element->taxon2)){ |
|
949 |
$out = render_taxon_or_name($element->taxon2, url(path_to_taxon($element->taxon2->uuid))); |
|
950 |
} |
|
951 |
|
|
952 |
$annotations_and_sources = handle_annotations_and_sources( |
|
953 |
$element, |
|
954 |
$feature_block_settings, |
|
955 |
$out, // the description element text |
|
956 |
$element->feature->uuid |
|
957 |
); |
|
958 |
|
|
959 |
if(!empty($annotations_and_sources['source_references'])){ |
|
960 |
$out .= ' ' . join(' ', $annotations_and_sources['source_references'] ); |
|
961 |
} |
|
962 |
return '<' . $enclosing_tag . '>' . $out . $annotations_and_sources['foot_note_keys'] . '</' . $enclosing_tag . '>'; |
|
963 |
|
|
964 |
} |
|
965 |
|
|
966 |
|
|
928 | 967 |
/** |
929 | 968 |
* Renders a single instance of the type IndividualsAssociations. |
930 | 969 |
* |
... | ... | |
1143 | 1182 |
break; |
1144 | 1183 |
case 'TaxonInteraction': |
1145 | 1184 |
$feature_block_has_content = true; |
1146 |
$elements_out_array[] = theme('cdm_descriptionElement_TaxonInteraction', array('element' => $descriptionElement));
|
|
1185 |
$elements_out_array[] = compose_description_element_taxon_interaction($descriptionElement, $feature_block_settings);
|
|
1147 | 1186 |
break; |
1148 | 1187 |
case 'Uses': |
1149 | 1188 |
/* IGNORE Uses classes, these are handled completely in theme_cdm_UseDescription */ |
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme | ||
---|---|---|
258 | 258 |
|
259 | 259 |
} |
260 | 260 |
|
261 |
|
|
262 |
/** |
|
263 |
* Theme function to render CDM DescriptionElements of the type TaxonInteraction. |
|
264 |
* |
|
265 |
* @param array $variables |
|
266 |
* An associative array containing: |
|
267 |
* - element: the TaxonInteraction element |
|
268 |
* @return html representation of the given TaxonInteraction element |
|
269 |
* |
|
270 |
* @ingroup themeable |
|
271 |
*/ |
|
272 |
function theme_cdm_descriptionElement_TaxonInteraction($variables) { |
|
273 |
|
|
274 |
$element = $variables['element']; |
|
275 |
|
|
276 |
$out = ''; |
|
277 |
|
|
278 |
if (isset($element->description_L10n)) { |
|
279 |
$out .= ' ' . $element->description_L10n; |
|
280 |
} |
|
281 |
|
|
282 |
if(isset($element->taxon2)){ |
|
283 |
$out = render_taxon_or_name($element->taxon2, url(path_to_taxon($element->taxon2->uuid))); |
|
284 |
} |
|
285 |
|
|
286 |
$feature_block_settings = get_feature_block_settings($element->feature->uuid); |
|
287 |
$annotations_and_sources = handle_annotations_and_sources( |
|
288 |
$element, |
|
289 |
$feature_block_settings, |
|
290 |
$out, // the description element text |
|
291 |
$element->feature->uuid |
|
292 |
); |
|
293 |
|
|
294 |
if(!empty($annotations_and_sources['source_references'])){ |
|
295 |
$out .= ' ' . join(' ', $annotations_and_sources['source_references'] ); |
|
296 |
} |
|
297 |
return $out . $annotations_and_sources['foot_note_keys']; |
|
298 |
|
|
299 |
} |
|
300 |
|
|
301 |
|
|
302 |
|
|
303 | 261 |
/** |
304 | 262 |
* @todo Please document this function. |
305 | 263 |
* @see http://drupal.org/node/1354 |
modules/cdm_dataportal/theme/theme_registry.inc | ||
---|---|---|
72 | 72 |
'FeatureTree_hierarchy' => array('variables' => array('FeatureTreeUuid' => NULL)), |
73 | 73 |
'FeatureTree_hierarchy_children' => array('variables' => array('node' => NULL)), |
74 | 74 |
'cdm_descriptionElement_CategoricalData' => array('render element' => 'element'), |
75 |
'cdm_descriptionElement_TaxonInteraction' => array('render element' => 'element'), |
|
76 | 75 |
'cdm_descriptionElement_QuantitativeData' => array('render element' => 'element'), |
77 | 76 |
'cdm_common_names' => array('render element' => 'elements', 'variables' => array('feature' => null) ), |
78 | 77 |
'cdm_description_element_image_source' => array('variables' => array( |
Also available in: Unified diff
#5583 turning theme function to compose method for IndividualsAssociations