539 |
539 |
has_feature_node_description_elements($node)) && $node->feature->uuid != UUID_IMAGE) { // skip empty or supressed features
|
540 |
540 |
|
541 |
541 |
$feature_name = cdm_term_representation($node->feature, 'Unnamed Feature');
|
|
542 |
$feature_block_settings = get_feature_block_settings($node->feature->uuid);
|
542 |
543 |
|
543 |
544 |
$block = feature_block($feature_name, $node->feature);
|
544 |
545 |
$block->content = array();
|
... | ... | |
577 |
578 |
$out_child_elements = '';
|
578 |
579 |
|
579 |
580 |
if (isset($node->descriptionElements)) {
|
580 |
|
$taxon_uuid = NULL;
|
581 |
|
if(isset($taxon) ) {
|
582 |
|
$taxon_uuid = $taxon->uuid;
|
583 |
|
}
|
584 |
|
$elements_render_array = compose_feature_block_items_generic($node->descriptionElements, $node->feature, $taxon_uuid);
|
|
581 |
$elements_render_array = compose_feature_block_items_generic($node->descriptionElements, $node->feature);
|
585 |
582 |
$block_content_is_empty = empty($elements_render_array);
|
586 |
583 |
$block->content[] = $elements_render_array;
|
587 |
584 |
}
|
... | ... | |
619 |
616 |
break;
|
620 |
617 |
case 'CategoricalData':
|
621 |
618 |
$out_child_elements = '<em>' . $child->feature->representation_L10n . '</em> '
|
622 |
|
. theme('cdm_descriptionElement_CategoricalData', array('element' => $element));
|
|
619 |
. compose_description_element_categorical_data($element, $feature_block_settings);
|
623 |
620 |
break;
|
624 |
621 |
case 'QuantitativeData':
|
625 |
622 |
$out_child_elements = '<em>' . $child->feature->representation_L10n . '</em> '
|
... | ... | |
1004 |
1001 |
|
1005 |
1002 |
}
|
1006 |
1003 |
|
|
1004 |
/**
|
|
1005 |
* Renders a single instance of the type CategoricalData.
|
|
1006 |
*
|
|
1007 |
* @param $element
|
|
1008 |
* The CDM CategoricalData entity
|
|
1009 |
*
|
|
1010 |
* @return string
|
|
1011 |
* a html representation of the given CategoricalData element
|
|
1012 |
*
|
|
1013 |
* @ingroup compose
|
|
1014 |
*/
|
|
1015 |
function compose_description_element_categorical_data($element, $feature_block_settings) {
|
|
1016 |
|
|
1017 |
$state_data_strings = array();
|
|
1018 |
if (isset($element->stateData)) {
|
|
1019 |
foreach ($element->stateData as $state_data) {
|
|
1020 |
|
|
1021 |
$state = NULL;
|
|
1022 |
|
|
1023 |
if (isset($state_data->state)) {
|
|
1024 |
$state = cdm_term_representation($state_data->state);
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
if (isset($state_data->modifyingText_L10n)) {
|
|
1028 |
$state = ' ' . $state_data->modifyingText_L10n;
|
|
1029 |
}
|
|
1030 |
|
|
1031 |
$modifiers_strings = cdm_modifers_representations($state_data);
|
|
1032 |
|
|
1033 |
$state_data_strings[] = $state . ($modifiers_strings ? ' ' . $modifiers_strings : '');
|
|
1034 |
|
|
1035 |
}
|
|
1036 |
}
|
|
1037 |
|
|
1038 |
|
|
1039 |
$out = '<span class="' . html_class_attribute_ref($element) . '">' . implode(', ', $state_data_strings) . '</span>';
|
|
1040 |
|
|
1041 |
$feature_block_settings = get_feature_block_settings($element->feature->uuid);
|
|
1042 |
$annotations_and_sources = handle_annotations_and_sources(
|
|
1043 |
$element,
|
|
1044 |
$feature_block_settings,
|
|
1045 |
$out, // The description element text.
|
|
1046 |
$element->feature->uuid
|
|
1047 |
);
|
|
1048 |
|
|
1049 |
if (!empty($annotations_and_sources['source_references'])) {
|
|
1050 |
$out .= ' ' . implode(' ', $annotations_and_sources['source_references']);
|
|
1051 |
}
|
|
1052 |
return $out . $annotations_and_sources['foot_note_keys'];
|
|
1053 |
}
|
|
1054 |
|
1007 |
1055 |
|
1008 |
1056 |
/**
|
1009 |
1057 |
* Creates a render array for string representations of description elements for the given feature.
|
... | ... | |
1161 |
1209 |
* TODO provide api_hook as extension point for this?
|
1162 |
1210 |
*/
|
1163 |
1211 |
$feature_block_settings = get_feature_block_settings($descriptionElement->feature->uuid);
|
1164 |
|
$asListElement = $feature_block_settings['as_list'] == 'ul';
|
1165 |
|
switch ($descriptionElement->class) {
|
|
1212 |
switch ($descriptionElement->class) {
|
1166 |
1213 |
case 'TextData':
|
|
1214 |
$asListElement = $feature_block_settings['as_list'] == 'ul';
|
1167 |
1215 |
$text_data_render_array = compose_description_element_textdata($descriptionElement, $asListElement, $descriptionElement->feature->uuid);
|
1168 |
1216 |
$feature_block_has_content = $feature_block_has_content || !empty($text_data_render_array['#value']);
|
1169 |
1217 |
$elements_out_array[] = drupal_render($text_data_render_array);
|
1170 |
1218 |
break;
|
1171 |
1219 |
case 'CategoricalData':
|
1172 |
1220 |
$feature_block_has_content = true;
|
1173 |
|
$elements_out_array[] = theme('cdm_descriptionElement_CategoricalData', array('element' => $descriptionElement));
|
|
1221 |
$elements_out_array[] = compose_description_element_categorical_data($descriptionElement, $feature_block_settings);
|
1174 |
1222 |
break;
|
1175 |
1223 |
case 'QuantitativeData':
|
1176 |
1224 |
$feature_block_has_content = true;
|
turning theme function to compose function for CategoricalData