Revision 92e522db
Added by Andreas Kohlbecker over 4 years ago
modules/cdm_dataportal/includes/common.inc | ||
---|---|---|
667 | 667 |
|
668 | 668 |
switch ($cdm_entity->class) { |
669 | 669 |
case 'TaxonDescription': |
670 |
$link = render_cdm_description($cdm_entity);
|
|
670 |
$link = '<span class="' . html_class_attribute_ref($cdm_entity) . '">' . $cdm_entity->titleCache . '</span> ' . icon_link(path_to_description($cdm_entity->uuid));
|
|
671 | 671 |
break; |
672 | 672 |
default: |
673 | 673 |
$link = '<span class="error">UNSUPPORTED CDM ENTITY TYPE</span>'; |
modules/cdm_dataportal/includes/descriptions.inc | ||
---|---|---|
2119 | 2119 |
|
2120 | 2120 |
} |
2121 | 2121 |
|
2122 |
|
|
2123 |
/** |
|
2124 |
* Renders the description and adds a link to the description detail page |
|
2125 |
* |
|
2126 |
* @param object $description |
|
2127 |
* the cdm description entity which will be linked to |
|
2128 |
* |
|
2129 |
* @param bool $show_description_elements |
|
2130 |
* if True the description elements will be rendered |
|
2131 |
* @param $descriptive_dataset_uuid |
|
2132 |
* the data set which should be passed to the description detail page |
|
2133 |
* |
|
2134 |
* @return string the markup for the description |
|
2135 |
*/ |
|
2136 |
function render_cdm_description($description, $show_description_elements = False, $descriptive_dataset_uuid = NULL) { |
|
2137 |
|
|
2138 |
$out = '<span class="' . html_class_attribute_ref($description) . '">' . $description->titleCache . '</span>'; |
|
2139 |
$path_to_description = path_to_description($description->uuid, $descriptive_dataset_uuid); |
|
2140 |
if($show_description_elements){ |
|
2141 |
$out = render_description_string($description, get_root_nodes_for_dataset($description)); |
|
2142 |
} |
|
2143 |
$out .= ' ' . icon_link($path_to_description); |
|
2144 |
|
|
2145 |
if($show_description_elements){ |
|
2146 |
$out .= '<div class="content-caption">'. t('Bracketed numbers denote sample size') . '</div>'; |
|
2147 |
} |
|
2148 |
|
|
2149 |
return $out; |
|
2150 |
} |
|
2151 |
|
|
2152 | 2122 |
/** |
2153 | 2123 |
* @param $description |
2154 | 2124 |
* @param $root_nodes |
... | ... | |
2320 | 2290 |
case 'TaxonDescription': |
2321 | 2291 |
case 'NameDescription': |
2322 | 2292 |
case 'SpecimenDescription': |
2323 |
$source_link_markup = render_cdm_description($cdm_source_entity);
|
|
2293 |
$source_link_markup = render_cdm_entity_link($cdm_source_entity);
|
|
2324 | 2294 |
break; |
2325 | 2295 |
default: |
2326 | 2296 |
$source_link_markup = '<span class="error">unhandled CdmSource</span>'; |
2327 | 2297 |
} |
2328 |
$items[] = [ |
|
2298 |
$items[$cdm_source_entity->titleCache] = [
|
|
2329 | 2299 |
'data' => $source_link_markup |
2330 | 2300 |
]; |
2331 | 2301 |
} |
2332 | 2302 |
} |
2303 |
ksort($items); |
|
2333 | 2304 |
$render_array['sources'] = [ |
2334 | 2305 |
'#title' => 'Sources', |
2335 | 2306 |
'#theme' => 'item_list', |
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
586 | 586 |
$feature_description = make_pseudo_feature('Descriptions (aggregated)', PSEUDO_FEATURE_AGGREGATION_DESCRIPTIONS); |
587 | 587 |
$description_item = ''; |
588 | 588 |
foreach ($aggregatedDescriptions as $description) { |
589 |
$description_item .= render_cdm_description($description, TRUE); |
|
589 |
$description_item = '<div class="' . html_class_attribute_ref($description) . '">'; |
|
590 |
$description_item .= render_description_string($description, get_root_nodes_for_dataset($description)); |
|
591 |
$description_item .= ' ' . icon_link(path_to_description($description->uuid)); |
|
592 |
$description_item .= '<div class="content-caption">'. t('Bracketed numbers denote sample size') . '</div>'; |
|
593 |
$description_item .= '</div>'; |
|
590 | 594 |
} |
591 | 595 |
$description_block = feature_block(t('Descriptions (aggregated)'), $feature_description); |
592 | 596 |
$description_block->content = []; |
Also available in: Unified diff
ref #8739 description sources in alphabetical order