Project

General

Profile

« Previous | Next » 

Revision 39ae8ca4

Added by Andreas Kohlbecker over 3 years ago

ref #8543 unification of annotation and source footnotes for related taxa etc.

View differences:

modules/cdm_dataportal/includes/descriptions.inc
481 481
 *        the name in source strings are de-duplicated
482 482
 *        !!!NOTE!!!!: this field will most probably be removed soon (TODO)
483 483
 *
484
 * @throws \Exception
485
 *
486 484
 * @see cdm_entities_annotations_footnote_keys()
487 485
 */
488 486
  function handle_annotations_and_sources($entity, $config, $inline_text_prefix, $footnote_list_key_suggestion) {
modules/cdm_dataportal/includes/pages.inc
717 717
    if(isset($name_relationships['list']['items'][0])){
718 718
      $accepted_name .= ' ' . drupal_render($name_relationships);
719 719
    }
720

  
721
    // handle annotations of the name and taxon
722
    $annotations_and_sources_taxon = handle_annotations_and_sources(
723
      $taxon,
724
      synonymy_annotations_and_source_config(),
725
      '',
726
      RenderHints::getFootnoteListKey());
727
    $annotations_and_sources_name = handle_annotations_and_sources(
728
      $taxon->name,
729
      synonymy_annotations_and_source_config(),
730
      '',
731
      RenderHints::getFootnoteListKey());
732

  
733
    $accepted_name .= $annotations_and_sources_taxon['foot_note_keys'] . ($annotations_and_sources_taxon['foot_note_keys'] && $annotations_and_sources_name['foot_note_keys'] ? ', ': '') . $annotations_and_sources_name['foot_note_keys'];
720
    $accepted_name .= render_taxon_and_name_footnotes($taxon);
734 721
    $accepted_name .= '</div>';
735 722
    RenderHints::popFromRenderStack();
736 723
  }
modules/cdm_dataportal/includes/taxon.inc
393 393
    $referenceUri = FALSE;
394 394
  }
395 395
  $out_taxon_part = render_taxon_or_name($taxon, $taxonUri, $referenceUri, TRUE, FALSE, $skip_tags, $is_invalid);
396
  $taxon_footnotes = render_entities_annotations_as_footnote_keys([$taxon->name,$taxon], $footnoteListKey);
396

  
397
  // must come before the rendering the relationships so that the footnote key
398
  // numbers are in correct order
399
  $taxon_and_name_footnotes = render_taxon_and_name_footnotes($taxon);
400

  
397 401
  $name_relations = cdm_name_relationships_for_taxon($taxon);
398 402
  $name_relations_render_array = compose_name_relationships_inline($name_relations, $taxon->name->uuid, $taxon->uuid);
399 403

  
400 404
  $out = '<span class="relation_sign" title="' . $reltype_representation . '">' . $relsign . '</span>'
401
    . $out_taxon_part . $taxon_footnotes;
405
    . $out_taxon_part . $taxon_and_name_footnotes;
402 406
  if(isset($name_relations_render_array['list']['items'][0])){
403 407
    $out .= ' '  . drupal_render($name_relations_render_array);
404 408
  }
......
410 414
  return $out;
411 415
}
412 416

  
417
/**
418
 * Convenience function to create footnotes of annotations and sources for a
419
 * taxon and name at the same time. Calls handle_annotations_and_sources()
420
 * internally twice and combines the resulting footnote markup
421
 *
422
 * @param $taxon
423
 *
424
 * @return string
425
 *
426
 * @see synonymy_annotations_and_source_config()
427
 */
428
function render_taxon_and_name_footnotes($taxon) {
429
  $annotations_and_sources_taxon = handle_annotations_and_sources(
430
    $taxon,
431
    synonymy_annotations_and_source_config(),
432
    '',
433
    RenderHints::getFootnoteListKey()
434
  );
435
  $annotations_and_sources_name = handle_annotations_and_sources(
436
    $taxon->name,
437
    synonymy_annotations_and_source_config(),
438
    '',
439
    RenderHints::getFootnoteListKey()
440
  );
441
  $footnotes = $annotations_and_sources_taxon['foo_note_keys'] .
442
    ($annotations_and_sources_taxon['foo_note_keys'] && $annotations_and_sources_name['foo_note_keys'] ? ',' : '') .
443
    $annotations_and_sources_name['foo_note_keys'];
444
  return $footnotes;
445
}
446

  
413 447

  
414 448
/**
415 449
 * Creates markup for a taxon which is the accepted of another one
......
571 605
            }
572 606
            $out .= '<span class="classifications"><span class="separator"> : </span>' . implode(', ', $classification_titles) . '</span>';
573 607
          }
574
          $out .= render_entities_annotations_as_footnote_keys([$taxon]);
608
          $out .= render_taxon_and_name_footnotes($taxon);
575 609
          if ($showMedia_synonyms) {
576 610
            $out .= theme('cdm_taxon_list_thumbnails', array('taxon' => $acceptedTaxon));
577 611
          }
......
599 633
        }
600 634
        $out .= '<span class="classifications"><span class="separator"> : </span>' . implode(', ', $classification_titles) . '</span>';
601 635
      }
602
      $out .= render_entities_annotations_as_footnote_keys([$taxon]);
636
      $out .= render_taxon_and_name_footnotes($taxon);
603 637

  
604 638
      if ($showMedia_taxa) {
605 639
        $out .= theme('cdm_taxon_list_thumbnails', array('taxon' => $taxon));

Also available in: Unified diff