Project

General

Profile

« Previous | Next » 

Revision 38a98e54

Added by Andreas Kohlbecker about 3 years ago

ref #6866 showing unit annotations (AnnotationsAndSources supports annotations a content now)

View differences:

modules/cdm_dataportal/includes/occurrences_new.inc
76 76
    // Annotations and Sources
77 77
    RenderHints::setAnnotationsAndSourceConfig([
78 78
      'sources_as_content' => TRUE,
79
      'annotations_as_content' => TRUE,
79 80
      'link_to_name_used_in_source' => TRUE,
80 81
      'link_to_reference' => FALSE,
81 82
      'add_footnote_keys' => FALSE,
......
85 86
    if ($annotations_and_sources->hasSourceReferences()) {
86 87
      $render_array['sources'] = compose_cdm_sob_dto_sources($sob_dto, $annotations_and_sources);
87 88
    }
89

  
90
    if(count($annotations_and_sources->getAnnotations()) > 0){
91
      $render_array['annotations'] = compose_cdm_sob_dto_annotations($sob_dto, $annotations_and_sources);
92
    }
88 93
      // Markers
89 94
    $markers = cdm_ws_get(CDM_WS_PORTAL_OCCURRENCE, [$sob_dto->uuid, 'markers']);
90 95
    if(isset_not_empty($markers->records)){
......
468 473
  return cdm_sob_dto_table($label, $table_row_data, $sob_dto, 1);
469 474
}
470 475

  
476
/**
477
 * @param $sob_dto
478
 * @param \AnnotationsAndSources $annotations_and_sources
479
 *
480
 * @return array|null
481
 */
482
function compose_cdm_sob_dto_annotations($sob_dto, $annotations_and_sources) {
483

  
484
  $table_row_data = [];
485

  
486
  foreach ($annotations_and_sources->getAnnotations() as $annotation_text) {
487
    $table_row_data[] = cdm_sob_dto_table_row(NULL, $annotation_text);
488
  }
489

  
490
  $label = count($table_row_data) > 1 ? t("Annotations") : t("Annotation");
491
  return cdm_sob_dto_table($label, $table_row_data, $sob_dto, 1);
492
}
493

  
471 494
function compose_cdm_sob_dto_markers($sob_dto, $markers) {
472 495

  
473 496
  $table_row_data = [];

Also available in: Unified diff