Project

General

Profile

« Previous | Next » 

Revision 9b8eb609

Added by Andreas Kohlbecker almost 4 years ago

ref #9102 fixing TaxonNode.source footnote missing & generalizing creation of bibliography block

View differences:

modules/cdm_dataportal/includes/descriptions.inc
346 346
 *    Optional parameter. If this parameter is left empty (null, 0, "") the footnote key will be determined by the nested
347 347
 *    method calls by calling RenderHints::getFootnoteListKey(). NOTE: the footnote key for annotations will be set to
348 348
 *    RenderHints::getFootnoteListKey().'-annotations'. @see cdm_annotations_as_footnotekeys()
349
 *    For original sources the $footnote_list_key_suggestion will be overwritten by original_source_footnote_list_key() when
349
 *    For original sources the $footnote_list_key_suggestion will be overwritten by bibliography_footnote_list_key() when
350 350
 *    $is_bibliography_aware is set TRUE.
351 351
 * @$original_source_footnote_tag
352
 *    null will cause original_source_footnote_list_key to use the default
352
 *    null will cause bibliography_footnote_list_key to use the default
353 353
 *
354 354
 * @return String
355 355
 *   The foot note keys
......
369 369
  $footNoteKeys = cdm_entity_annotations_as_footnotekeys($description_element, $footnote_list_key_suggestion);
370 370

  
371 371
  // Source references as footnotes.
372
  $sources_footnote_list_key = original_source_footnote_list_key($footnote_list_key_suggestion);
373 372
  if($is_bibliography_aware){
374 373
    $bibliography_settings = get_bibliography_settings();
375
    $original_source_footnote_tag = $bibliography_settings['enabled'] == 1 ? 'div' : null; // null will cause original_source_footnote_list_key to use the default
374
    $sources_footnote_list_key = bibliography_footnote_list_key($footnote_list_key_suggestion);
375
    $original_source_footnote_tag = $bibliography_settings['enabled'] == 1 ? 'div' : null; // null will cause bibliography_footnote_list_key to use the default
376 376
  } else {
377
    $sources_footnote_list_key = $footnote_list_key_suggestion;
378
    if(!$sources_footnote_list_key) {
379
      RenderHints::getFootnoteListKey();
380
    }
377 381
    $original_source_footnote_tag = NULL;
378 382
  }
379 383

  
......
653 657
   * @return string
654 658
   *  the footnote_list_key
655 659
   */
656
  function original_source_footnote_list_key($key_suggestion = null) {
660
  function bibliography_footnote_list_key($key_suggestion = null) {
657 661
    if(!$key_suggestion){
658 662
      $key_suggestion = RenderHints::getFootnoteListKey();
659 663
    }
modules/cdm_dataportal/includes/pages.inc
389 389
  }
390 390

  
391 391

  
392
  // set up the TOC for the pages which contain all pageparts
392
  // set up the TOC and pseudo feature blocks for the pages which contain all pageparts
393 393
  if($page_part == 'all') {
394

  
395
    $bibliography_block = make_bibliography_feature_block();
396
    if($bibliography_block){
397
      $render_array['bibliography_block'] = $bibliography_block;
398
      $render_array['bibliography_block']['#weight'] = 100;
399
      cdm_toc_list_add_item('Bibliography', 'bibliography', null, false, $render_array['bibliography_block']['#weight']);
400
    }
401

  
394 402
    $toc_elements = [];
395 403
    asort($taxontabs_weights);
396 404
    foreach(array_keys($taxontabs_weights) as $tab_key){
......
556 564

  
557 565
  // >>>>>>>>>>>>>>>>>>> PSEUDO FEATURES >>>>>>>>>>>>>>>>>>>
558 566
  $pseudo_feature_weights = get_array_variable_merged(CDM_PSEUDO_FEATURE_BLOCK_WEIGHTS, CDM_PSEUDO_FEATURE_BLOCK_WEIGHTS_DEFAULT);
559
  // Bibliography
560
  $bibliography_settings = get_bibliography_settings();
561
  if($bibliography_settings['enabled'] == 1){
562
    $bibliography_markup = FootnoteManager::renderFootnoteList(PSEUDO_FEATURE_BIBLIOGRAPHY, '');
563
    if($bibliography_markup) {
564
      $feature_bibliography = make_pseudo_feature('Bibliography', PSEUDO_FEATURE_BIBLIOGRAPHY);
565
      $bibliography_item = markup_to_render_array($bibliography_markup);
566
      $bibliography_block = feature_block(t('Bibliography'), $feature_bibliography);
567
      $bibliography_block->content = array();
568
      $bibliography_block->content[] = compose_feature_block_wrap_elements(array($bibliography_item), $feature_bibliography);
569 567

  
570
      $feature_block_list[$pseudo_feature_weights[PSEUDO_FEATURE_BIBLIOGRAPHY]] = $bibliography_block;
571
      cdm_toc_list_add_item('Bibliography', 'bibliography', null, false, $pseudo_feature_weights[PSEUDO_FEATURE_BIBLIOGRAPHY]);
572
    }
568
  // Bibliography
569
  $bibliography_block = make_bibliography_feature_block();
570
  if($bibliography_block){
571
    $feature_block_list[$pseudo_feature_weights[PSEUDO_FEATURE_BIBLIOGRAPHY]] = $bibliography_block;
572
    cdm_toc_list_add_item('Bibliography', 'bibliography', null, false, $pseudo_feature_weights[PSEUDO_FEATURE_BIBLIOGRAPHY]);
573 573
  }
574 574

  
575 575
  // Descriptions (aggregated)
......
624 624
  return $render_array;
625 625
}
626 626

  
627
/**
628
 * @return object|\stdclass
629
 */
630
function make_bibliography_feature_block() {
631
  $bibliography_block = null;
632
  $bibliography_settings = get_bibliography_settings();
633
  if ($bibliography_settings['enabled'] == 1) {
634
    $bibliography_markup = FootnoteManager::renderFootnoteList(PSEUDO_FEATURE_BIBLIOGRAPHY, '');
635
    if ($bibliography_markup) {
636
      $feature_bibliography = make_pseudo_feature('Bibliography', PSEUDO_FEATURE_BIBLIOGRAPHY);
637
      $bibliography_item = markup_to_render_array($bibliography_markup);
638
      $bibliography_block = feature_block(t('Bibliography'), $feature_bibliography);
639
      $bibliography_block->content = [];
640
      $bibliography_block->content[] = compose_feature_block_wrap_elements([$bibliography_item], $feature_bibliography);
641
    }
642
  }
643
  return $bibliography_block;
644
}
645

  
627 646

  
628 647
/**
629 648
 * Renders the link which will lead to the specimen detail page
modules/cdm_dataportal/includes/taxon-node.inc
32 32
  if($taxon_nodes && count($taxon_nodes) > 0){
33 33
    $label_plural = false;
34 34
    $status_markup_tokens = [];
35
    $bibliography_settings = get_bibliography_settings();
35 36
    foreach ($taxon_nodes as $taxon_node){
36 37

  
37 38
      $annotations_and_sources = handle_annotations_and_sources($taxon_node,
......
40 41
        'link_to_name_used_in_source' => false,
41 42
        'link_to_reference' => true,
42 43
        'add_footnote_keys' => true,
43
        'bibliography_aware' => false),
44
        'bibliography_aware' => $bibliography_settings['enabled'] == 1),
44 45
        '',
45 46
        null);
46 47

  

Also available in: Unified diff