Project

General

Profile

« Previous | Next » 

Revision aa26f9f0

Added by Andreas Kohlbecker over 7 years ago

restructuring description element code

View differences:

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
  );

Also available in: Unified diff