Revision aa26f9f0
Added by Andreas Kohlbecker over 7 years ago
modules/cdm_dataportal/cdm_dataportal.api.php | ||
---|---|---|
51 | 51 |
} |
52 | 52 |
if ($numberOfChildren > 0) { |
53 | 53 |
$block = feature_block('Number of Taxa'); |
54 |
// FIXME use compose_cdm_feature_block_elements() in next line
|
|
54 |
// FIXME use compose_feature_block_elements() in next line |
|
55 | 55 |
$block->content = array(markup_to_render_array( |
56 | 56 |
'<ul class="feature-block-elements"><li>' |
57 | 57 |
. $numberOfChildren . " " . $subRank |
modules/cdm_dataportal/cdm_dataportal.module | ||
---|---|---|
2303 | 2303 |
* source reference is considered to be not empty. |
2304 | 2304 |
* |
2305 | 2305 |
* @TODO this function may have become obsolete by the new method of detecting empty blocks, |
2306 |
* see $block_content_is_not_empty in compose_cdm_feature_nodes() and
|
|
2307 |
* $feature_block_has_content in compose_description_elements |
|
2306 |
* see $block_content_is_not_empty in compose_feature_blocks() and
|
|
2307 |
* $feature_block_has_content in compose_description_elements_other_features
|
|
2308 | 2308 |
*/ |
2309 | 2309 |
function has_feature_node_description_elements($featureNode) { |
2310 | 2310 |
|
modules/cdm_dataportal/includes/descriptions.inc | ||
---|---|---|
496 | 496 |
* |
497 | 497 |
* @ingroup compose |
498 | 498 |
*/ |
499 |
function compose_cdm_feature_nodes($mergedFeatureNodes, $taxon) {
|
|
499 |
function compose_feature_blocks($mergedFeatureNodes, $taxon) {
|
|
500 | 500 |
|
501 | 501 |
$block_list = array(); |
502 | 502 |
|
... | ... | |
553 | 553 |
if(isset($taxon) ) { |
554 | 554 |
$taxon_uuid = $taxon->uuid; |
555 | 555 |
} |
556 |
$elements_render_array = compose_description_elements($node->descriptionElements, $node->feature, $taxon_uuid); |
|
556 |
$elements_render_array = compose_description_elements_other_features($node->descriptionElements, $node->feature, $taxon_uuid);
|
|
557 | 557 |
$block_content_is_empty = empty($elements_render_array); |
558 | 558 |
$block->content[] = $elements_render_array; |
559 | 559 |
} |
... | ... | |
573 | 573 |
if (isset($child->descriptionElements) && is_array($child->descriptionElements)) { |
574 | 574 |
foreach ($child->descriptionElements as $element) { |
575 | 575 |
|
576 |
//TODO it woud be better if we could use compose_description_elements() directly instead of the below stuff |
|
576 |
//TODO it woud be better if we could use compose_description_elements_other_features() directly instead of the below stuff
|
|
577 | 577 |
|
578 | 578 |
if (is_array($element->media)) { |
579 | 579 |
// Append media of subordinate elements to list of main |
... | ... | |
719 | 719 |
|
720 | 720 |
if (!array_search($repr, $text_data_out_array)) { // de-duplication !! |
721 | 721 |
$text_data_out_array[] = $repr; |
722 |
// TODO HINT: sorting in compose_cdm_feature_block_elements will
|
|
722 |
// TODO HINT: sorting in compose_feature_block_elements will |
|
723 | 723 |
// not work since this array contains html attributes with uuids |
724 | 724 |
// and what is about cases like the bibliography where |
725 | 725 |
// any content can be prefixed with some foot-note anchors? |
... | ... | |
732 | 732 |
|
733 | 733 |
|
734 | 734 |
if ($text_data_out_array && variable_get(DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP, 0)) { |
735 |
$block->content[] = compose_cdm_feature_block_elements(
|
|
735 |
$block->content[] = compose_feature_block_elements( |
|
736 | 736 |
$text_data_out_array, |
737 | 737 |
$feature, |
738 | 738 |
$text_data_glue, |
... | ... | |
822 | 822 |
|
823 | 823 |
} |
824 | 824 |
// |
825 |
$block->content[] = compose_cdm_feature_block_elements(
|
|
825 |
$block->content[] = compose_feature_block_elements( |
|
826 | 826 |
$dto_out_array, |
827 | 827 |
$feature, |
828 | 828 |
$distribution_glue, |
... | ... | |
833 | 833 |
|
834 | 834 |
// --- TextData at the bottom |
835 | 835 |
if ($text_data_out_array && !variable_get(DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP, 0)) { |
836 |
$block->content[] = compose_cdm_feature_block_elements(
|
|
836 |
$block->content[] = compose_feature_block_elements( |
|
837 | 837 |
$text_data_out_array, |
838 | 838 |
$feature, |
839 | 839 |
$text_data_glue, |
... | ... | |
939 | 939 |
* |
940 | 940 |
* @ingroup compose |
941 | 941 |
*/ |
942 |
function compose_cdm_feature_block_elements(array $elements, $feature, $glue = '', $sort = FALSE, $enclosing_tag = 'ul') {
|
|
942 |
function compose_feature_block_elements(array $elements, $feature, $glue = '', $sort = FALSE, $enclosing_tag = 'ul') { |
|
943 | 943 |
|
944 | 944 |
$feature_block_settings = get_feature_block_settings($feature->uuid); |
945 | 945 |
if($feature_block_settings['as_list']){ |
... | ... | |
1048 | 1048 |
* |
1049 | 1049 |
* @ingroup compose |
1050 | 1050 |
*/ |
1051 |
function compose_description_elements($descriptionElements, $feature) { |
|
1051 |
function compose_description_elements_other_features($descriptionElements, $feature) {
|
|
1052 | 1052 |
|
1053 | 1053 |
$render_array = array(); |
1054 | 1054 |
$elements_out_array = array(); |
... | ... | |
1112 | 1112 |
if ($descriptionElement->feature->uuid == UUID_CITATION) { |
1113 | 1113 |
sort($elements_out_array); |
1114 | 1114 |
} |
1115 |
|
|
1116 |
} // END normal description element arrays |
|
1115 |
} |
|
1117 | 1116 |
|
1118 | 1117 |
if($feature_block_has_content){ |
1119 |
$render_array = compose_cdm_feature_block_elements(
|
|
1118 |
$render_array = compose_feature_block_elements( |
|
1120 | 1119 |
$elements_out_array, |
1121 | 1120 |
$feature |
1122 | 1121 |
); |
... | ... | |
1206 | 1205 |
} // End of loop over set of elements per language area |
1207 | 1206 |
|
1208 | 1207 |
|
1209 |
$common_name_feature_elements_render_array = compose_cdm_feature_block_elements(
|
|
1208 |
$common_name_feature_elements_render_array = compose_feature_block_elements( |
|
1210 | 1209 |
$common_name_feature_elements, |
1211 | 1210 |
$feature, |
1212 | 1211 |
'; ', |
... | ... | |
1228 | 1227 |
$text_data_out[] = drupal_render($text_data_render_array); |
1229 | 1228 |
} |
1230 | 1229 |
|
1231 |
$common_name_out_text_data = compose_cdm_feature_block_elements(
|
|
1230 |
$common_name_out_text_data = compose_feature_block_elements( |
|
1232 | 1231 |
$text_data_out, |
1233 | 1232 |
$feature |
1234 | 1233 |
); |
modules/cdm_dataportal/includes/occurrences.inc | ||
---|---|---|
397 | 397 |
// continue; |
398 | 398 |
// } |
399 | 399 |
$elements_by_feature = _mergeFeatureTreeDescriptions($occurrence_featureTree->root->childNodes, $description->elements); |
400 |
$description_render_elements = compose_cdm_feature_nodes($elements_by_feature, null);
|
|
400 |
$description_render_elements = compose_feature_blocks($elements_by_feature, null);
|
|
401 | 401 |
$dd_elements[] = $description_render_elements; |
402 | 402 |
} |
403 | 403 |
|
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
729 | 729 |
|
730 | 730 |
|
731 | 731 |
// Render the sections for each feature |
732 |
$render_array['taxon_description_features'] = compose_cdm_feature_nodes($merged_tree->root->childNodes, $taxon);
|
|
732 |
$render_array['taxon_description_features'] = compose_feature_blocks($merged_tree->root->childNodes, $taxon);
|
|
733 | 733 |
|
734 | 734 |
$bibliography_settings = get_bibliography_settings(); |
735 | 735 |
if($bibliography_settings['enabled'] == 1){ |
modules/cdm_dataportal/settings.php | ||
---|---|---|
513 | 513 |
* @return array |
514 | 514 |
* an associative array of settings, with the following fields: |
515 | 515 |
* - as_list: string |
516 |
* this setting will be used in compose_cdm_feature_block_elements() as $enclosing_tag
|
|
516 |
* this setting will be used in compose_feature_block_elements() as $enclosing_tag |
|
517 | 517 |
* possible values are: |
518 | 518 |
* div: not as list, |
519 | 519 |
* ul: as bullet list, |
... | ... | |
549 | 549 |
* possible values are the constants SORT_ASC, SORT_DESC, NULL, |
550 | 550 |
* some feature types (Distribution) also support: SORT_HIERARCHICAL ( |
551 | 551 |
* TODO option to exclude levels, put in special?, |
552 |
* TODO make use of this setting in compose_cdm_feature_block_elements())
|
|
552 |
* TODO make use of this setting in compose_feature_block_elements()) |
|
553 | 553 |
* - element_tag |
554 | 554 |
* specifies the tag to be used for creating the elements, only applies if "as_list" == 'div' |
555 | 555 |
* possible values are span | div. the proper inner tag name can be retrieved by the function |
... | ... | |
562 | 562 |
*/ |
563 | 563 |
function get_feature_block_settings($feature_uuid = 'DEFAULT') { |
564 | 564 |
// the default must conform to the default parameter values of |
565 |
// compose_cdm_feature_block_elements() : $glue = '', $sort = FALSE, $enclosing_tag = 'ul'
|
|
565 |
// compose_feature_block_elements() : $glue = '', $sort = FALSE, $enclosing_tag = 'ul' |
|
566 | 566 |
// compose_description_element_textdata() : asListElement = NULL |
567 | 567 |
|
568 | 568 |
// see #3257 (implement means to define the features to show up in the taxonprofile and in the specimen descriptions) |
modules/palmweb/palmweb.module | ||
---|---|---|
40 | 40 |
} |
41 | 41 |
if ($numberOfChildren > 0) { |
42 | 42 |
$block = feature_block('Number of Taxa'); |
43 |
// FIXME use compose_cdm_feature_block_elements() in next line
|
|
43 |
// FIXME use compose_feature_block_elements() in next line |
|
44 | 44 |
$block->content = array(markup_to_render_array('<ul class="feature-block-elements"><li>' . $numberOfChildren . " " . $subRank . '</li></ul>')); |
45 | 45 |
array_unshift($block_list, $block); |
46 | 46 |
cdm_toc_list_add_item('Number of Taxa', 'number-of-taxa', NULL, TRUE); |
themes/garland_diptera/template.php | ||
---|---|---|
202 | 202 |
|
203 | 203 |
$feature = NULL; |
204 | 204 |
// FIXME the below line was plain wrong before refactoring from theme to compose function |
205 |
// it was like theme('compose_cdm_feature_block_elements', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
|
|
205 |
// it was like theme('compose_feature_block_elements', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml); |
|
206 | 206 |
// which could never have worked |
207 |
return compose_cdm_feature_block_elements($outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
|
|
207 |
return compose_feature_block_elements($outArray, $feature, $glue, $sortOutArray, $enclosingHtml); |
|
208 | 208 |
} |
209 | 209 |
|
210 | 210 |
/** |
Also available in: Unified diff
restructuring description element code