Project

General

Profile

« Previous | Next » 

Revision 0e617798

Added by Andreas Kohlbecker over 2 years ago

ref #8850 showing fieldunit annotations in registration page

View differences:

modules/cdm_dataportal/includes/descriptions.inc
345 345
 * @param $footnote_list_key_suggestion string
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
 *    RenderHints::getFootnoteListKey().'-annotations'. @return String
348
 *    RenderHints::getFootnoteListKey().'-annotations'.
349
 *
350
 * @return String
349 351
 *   The foot note keys
350 352
 *
351 353
 * @see cdm_entities_annotations_as_footnotekeys()
......
367 369
  $sources = cdm_entity_sources_sorted($description_element);
368 370

  
369 371
  // Annotations as footnotes.
370
  $footNoteKeys = cdm_entity_annotations_as_footnotekeys($description_element, $footnote_list_key_suggestion);
372
  $footnote_keys = cdm_entity_annotations_as_footnotekeys($description_element, $footnote_list_key_suggestion);
371 373

  
372 374
  // Source references as footnotes.
373 375
  if($is_bibliography_aware){
......
394 396
        $original_source_footnote_tag
395 397
      );
396 398
      // Ensure uniqueness of the footnote keys.
397
      cdm_add_footnote_to_array($footNoteKeys, $fn_key);
399
      cdm_add_footnote_to_array($footnote_keys, $fn_key);
398 400
    }
399 401
  }
400 402
  // Sort and render footnote keys.
401
  $footnoteKeyListStr = '';
402
  asort($footNoteKeys);
403
  foreach ($footNoteKeys as $footNoteKey) {
404
    try{
405
      $footnoteKeyListStr .= theme('cdm_footnote_key',
403
  asort($footnote_keys);
404
  $footnotes_markup = footnote_keys_to_markup($footnote_keys, $separator);
405
  return $footnotes_markup;
406
}
407

  
408
/**
409
 * Creates markup for an array of foot note keys
410
 *
411
 * @param array $footnote_keys
412
 * @param string $separator
413
 *
414
 * @return string
415
 */
416
function footnote_keys_to_markup(array $footnote_keys, string $separator): string {
417

  
418
  $footnotes_markup = '';
419
  foreach ($footnote_keys as $foot_note_key) {
420
    try {
421
      $footnotes_markup .= theme('cdm_footnote_key',
406 422
        array(
407
          'footnoteKey' => $footNoteKey,
408
          'separator' => ($footnoteKeyListStr ? $separator : '')));
423
          'footnoteKey' => $foot_note_key,
424
          'separator' => ($footnotes_markup ? $separator : '')
425
        ));
409 426
    } catch (Exception $e) {
410
      drupal_set_message("Exception: " . $e->getMessage(),  'error');
427
      drupal_set_message("Exception: " . $e->getMessage(), 'error');
411 428
    }
412 429
  }
413
  return $footnoteKeyListStr;
430
  return $footnotes_markup;
414 431
}
415 432

  
416 433

  
......
559 576

  
560 577
    $annotations_and_sources = array(
561 578
      'foot_note_keys' => NULL,
562
      'source_references' => array(),
563
      'names_used_in_source' => array()
579
      'source_references' => [],
580
      'names_used_in_source' => []
564 581
    );
565 582

  
566 583
    // some entity types only have single sources:
......
596 613
        }
597 614
      } // END of loop over sources
598 615

  
599
      // annotations footnotes separate.
600
      $annotations_and_sources['foot_note_keys'] = theme('cdm_entities_annotations_as_footnotekeys',
601
        array(
602
          'cdmBase_list' => $entity,
603
          'footnote_list_key' => $footnote_list_key_suggestion,
604
        )
616
      // annotations footnotes separate from sources
617
      $annotations_and_sources['foot_note_keys'] = footnote_keys_to_markup(
618
        cdm_entity_annotations_as_footnotekeys($entity, $footnote_list_key_suggestion), ', '
605 619
      );
606 620

  
607 621
    } // END of references inline

Also available in: Unified diff