Project

General

Profile

« Previous | Next » 

Revision 4a3669c6

Added by Patrick Plitzner over 4 years ago

ref #8596 Only show TOC entry when data available

View differences:

modules/cdm_dataportal/includes/pages.inc
580 580
  $descriptionTypes['descriptionTypes'] = ("AGGREGATED");
581 581
  $aggregatedDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxon->uuid . '/descriptions', $descriptionTypes);
582 582

  
583
  // descriptions pseudo feature
584
  $feature_description = make_pseudo_feature('Aggregation Descriptions', 'AGGREGATION_DESCRIPTIONS');
585
  $description_item = "";
586
  foreach ($aggregatedDescriptions as $description){
587
    $description_item .= render_cdm_description_link($description);
588
  }
589
  $description_block = feature_block(t('Aggregation Descriptions'), $feature_description);
590
  $description_block->content = array();
591
  $description_block->content[] = compose_feature_block_wrap_elements(array($description_item), $feature_description);
592

  
593
  $pseudo_feature_block_toc_items['Aggregation Descriptions']= 'aggregation_descriptions';
594
  $pseudo_feature_blocks[] = $description_block;
583
  if (isset($aggregatedDescriptions) and !empty($aggregatedDescriptions)) {
584
    // descriptions pseudo feature
585
    $feature_description = make_pseudo_feature('Aggregation Descriptions', 'AGGREGATION_DESCRIPTIONS');
586
    $description_item = "";
587
    foreach ($aggregatedDescriptions as $description) {
588
      $description_item .= render_cdm_description_link($description);
589
    }
590
    $description_block = feature_block(t('Aggregation Descriptions'), $feature_description);
591
    $description_block->content = [];
592
    $description_block->content[] = compose_feature_block_wrap_elements([$description_item], $feature_description);
595 593

  
596
  $render_array['taxon_description_features'] = _block_get_renderable_array(
597
    array_merge($feature_block_list, $pseudo_feature_blocks)
598
  );
594
    $pseudo_feature_block_toc_items['Aggregation Descriptions'] = 'aggregation_descriptions';
595
    $pseudo_feature_blocks[] = $description_block;
599 596

  
600
  if($pseudo_feature_block_toc_items){
597
    $render_array['taxon_description_features'] = _block_get_renderable_array(
598
      array_merge($feature_block_list, $pseudo_feature_blocks)
599
    );
600
  }
601
  if ($pseudo_feature_block_toc_items){
601 602
    foreach ($pseudo_feature_block_toc_items as $label=>$fragment){
602 603
      cdm_toc_list_add_item($label, $fragment);
603 604
    }

Also available in: Unified diff