Project

General

Profile

« Previous | Next » 

Revision 67ab92f3

Added by Patrick Plitzner over 4 years ago

ref #8673 Adapt portal to CdmSource eager loading

View differences:

modules/cdm_dataportal/includes/pages.inc
584 584
        $feature_description = make_pseudo_feature('Descriptions (aggregated)', 'AGGREGATION_DESCRIPTIONS');
585 585
        $description_item = "";
586 586
        foreach ($aggregatedDescriptions as $description) {
587
            $description_item .= render_cdm_description_link($description);
587
            $description_item .= render_cdm_description_link($description, $renderDescriptionElements = True);
588 588
        }
589 589
        $description_block = feature_block(t('Descriptions (aggregated)'), $feature_description);
590 590
        $description_block->content = [];
......
626 626
 * @return string
627 627
 *     the markup for the link
628 628
 */
629
function render_cdm_description_link($description, $linkText = '') {
630
  if(empty($linkText)){
629
function render_cdm_description_link($description, $linkText = '', $renderDescriptionElements = False) {
630
  if (empty($linkText)) {
631 631
    $linkText = $description->titleCache;
632 632
  }
633 633
  $pathToDescription = path_to_description($description->uuid);
634 634
  $attributes['class'][] = html_class_attribute_ref($description);
635 635
  $descriptionString = '';
636
  foreach ($description->elements as $element) {
637
    switch ($element->class) {
638
      case 'CategoricalData':
639
        $state_data = compose_state_data($element);
640
        $state_data = implode(', ', $state_data);
641
        if(!empty($state_data)){
642
          $descriptionString .= '<i>'.$element->feature->representation_L10n.'</i>: '. $state_data."; ";
643
        }
644
        break;
645
      case 'QuantitativeData':
646
          $descriptionString .= '<i>'.$element->feature->representation_L10n.'</i>: '.compose_quant_stats($element)."; ";
647
        break;
636
  if ($renderDescriptionElements) {
637
    foreach ($description->elements as $element) {
638
      switch ($element->class) {
639
        case 'CategoricalData':
640
          $state_data = compose_state_data($element);
641
          $state_data = implode(', ', $state_data);
642
          if (!empty($state_data)) {
643
            $descriptionString .= '<i>' . $element->feature->representation_L10n . '</i>: ' . $state_data . "; ";
644
          }
645
          break;
646
        case 'QuantitativeData':
647
          $descriptionString .= '<i>' . $element->feature->representation_L10n . '</i>: ' . compose_quant_stats($element) . "; ";
648
          break;
649
      }
648 650
    }
649 651
  }
650 652
  $detail_html = $descriptionString.l($linkText, $pathToDescription, array('attributes' => $attributes))."<br><br>";

Also available in: Unified diff