Revision ae93540f
Added by Andreas Kohlbecker over 3 years ago
modules/cdm_dataportal/cdm_dataportal.module | ||
---|---|---|
2455 | 2455 |
} |
2456 | 2456 |
} |
2457 | 2457 |
|
2458 |
/** |
|
2459 |
* @param $uuid |
|
2460 |
* |
|
2461 |
* @return string |
|
2462 |
*/ |
|
2463 |
function path_to_collection($uuid) { |
|
2464 |
if (!$uuid) { |
|
2465 |
return ''; |
|
2466 |
} |
|
2467 |
else { |
|
2468 |
return 'cdm_dataportal/collection/' . $uuid; |
|
2469 |
} |
|
2470 |
} |
|
2471 |
|
|
2458 | 2472 |
/** |
2459 | 2473 |
* Creates a URL to show a synonmy in the according taxon page. |
2460 | 2474 |
* |
modules/cdm_dataportal/includes/occurrences.inc | ||
---|---|---|
592 | 592 |
break; |
593 | 593 |
|
594 | 594 |
case 'collection': |
595 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), render_collection($value)); |
|
595 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), array( |
|
596 |
array('#markup' => render_collection($value)) |
|
597 |
)); |
|
596 | 598 |
break; |
597 | 599 |
|
598 | 600 |
case 'storedUnder': |
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
1515 | 1515 |
/** |
1516 | 1516 |
* Renders a cdm collection entity as html markup. |
1517 | 1517 |
* |
1518 |
* institute and subcollection
|
|
1518 |
* institute and super-collections
|
|
1519 | 1519 |
* |
1520 | 1520 |
* @param $collection |
1521 |
* The CDM Collection entity |
|
1522 |
* @param bool $do_link |
|
1523 |
* Append a link to the collection page as clickable icon (default = true). |
|
1521 | 1524 |
* |
1522 | 1525 |
* @return string |
1523 | 1526 |
* The markup for the collection, |
1524 | 1527 |
*/ |
1525 |
function render_collection($collection, $do_link = true){
|
|
1528 |
function render_collection($collection, $do_link = false /* to be made true, see #9250 */ ){
|
|
1526 | 1529 |
if(!is_object($collection)){ |
1527 | 1530 |
return ''; |
1528 | 1531 |
} |
... | ... | |
1542 | 1545 |
} |
1543 | 1546 |
$markup = join(' in ', $collection_str_list); |
1544 | 1547 |
if($markup){ |
1548 |
if($do_link){ |
|
1549 |
$markup .= ' ' . cdm_internal_link(path_to_collection($collection->uuid)); |
|
1550 |
} |
|
1545 | 1551 |
$markup = '<span class="' . html_class_attribute_ref($collection) . '">' . $markup . '</span>'; |
1546 | 1552 |
} |
1547 | 1553 |
return $markup; |
modules/cdm_dataportal/includes/pre-drupal8.inc | ||
---|---|---|
169 | 169 |
* which can be trimmed to an empty string. The $group array will be associative in order to |
170 | 170 |
* ease alphabetical ordering of the entries. |
171 | 171 |
* |
172 |
* NOTE: To be used only for themable description_list as proposed in |
|
172 |
* NOTE: To be used only for themeable description_list as proposed in
|
|
173 | 173 |
* http://drupal.org/node/54898 see includes/pre-drupal8.inc |
174 | 174 |
* |
175 | 175 |
* @param array $groups |
modules/cdm_dataportal/theme/cdm_dataportal.references.theme | ||
---|---|---|
24 | 24 |
* |
25 | 25 |
* @param reference |
26 | 26 |
* The entity to be rendered |
27 |
* @param string $microReference
|
|
27 |
* @param string $citation_detail
|
|
28 | 28 |
* The citation detail like page number |
29 |
* @param boolean doTextLink
|
|
29 |
* @param boolean do_text_link
|
|
30 | 30 |
* Show the citation string as link to the reference page. This option does not affect links to the reference URI or DOI. |
31 | 31 |
* These links are always created when this data is available |
32 |
* @param boolean doIconLink
|
|
32 |
* @param boolean do_icon_link
|
|
33 | 33 |
* Append an icon to the citation string which links to the reference page, links to the reference URI or DOI are always |
34 | 34 |
* created when this data is available |
35 | 35 |
* |
36 | 36 |
* @return string |
37 | 37 |
* the markup for the reference |
38 | 38 |
*/ |
39 |
function cdm_reference_markup($reference, $microReference = NULL, $doTextLink = FALSE, $doIconLink = FALSE) {
|
|
39 |
function cdm_reference_markup($reference, $citation_detail = NULL, $do_text_link = FALSE, $do_icon_link = FALSE) {
|
|
40 | 40 |
|
41 | 41 |
$citation = trim($reference->titleCache); |
42 |
$iconlink = ""; |
|
43 |
if((isset($doIconLink) && $doIconLink === TRUE)) {
|
|
44 |
$iconlink = l(custom_icon_font_markup('icon-interal-link-alt-solid', array('class' => array('superscript'))), path_to_reference($reference->uuid), array('html' => true));
|
|
42 |
$icon_link = "";
|
|
43 |
if((isset($do_icon_link) && $do_icon_link === TRUE)) {
|
|
44 |
$icon_link = cdm_internal_link(path_to_reference($reference->uuid));
|
|
45 | 45 |
} |
46 |
if (isset($doTextLink) && $doTextLink === TRUE) {
|
|
46 |
if (isset($do_text_link) && $do_text_link === TRUE) {
|
|
47 | 47 |
$out = '<span class="reference">'; |
48 | 48 |
$out .= l($citation, path_to_reference($reference->uuid), array( |
49 | 49 |
'attributes' => array( |
... | ... | |
52 | 52 |
'absolute' => TRUE, |
53 | 53 |
'html' => TRUE, |
54 | 54 |
)); |
55 |
$out .= $iconlink . '</span>'; |
|
55 |
$out .= $icon_link . '</span>';
|
|
56 | 56 |
} |
57 | 57 |
else { |
58 |
$out = '<span class="reference">' . $citation . $iconlink . '</span>'; |
|
58 |
$out = '<span class="reference">' . $citation . $icon_link . '</span>';
|
|
59 | 59 |
} |
60 | 60 |
|
61 |
if (!empty($microReference)) {
|
|
62 |
$out .= ": " . $microReference;
|
|
61 |
if (!empty($citation_detail)) {
|
|
62 |
$out .= ": " . $citation_detail;
|
|
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
if(isset($reference->doi)){ |
... | ... | |
78 | 78 |
return $out; |
79 | 79 |
} |
80 | 80 |
|
81 |
/** |
|
82 |
* @param $path |
|
83 |
* |
|
84 |
* @return string |
|
85 |
*/ |
|
86 |
function cdm_internal_link($path) { |
|
87 |
return l(custom_icon_font_markup('icon-interal-link-alt-solid', array('class' => array('superscript'))), $path, array('html' => true)); |
|
88 |
} |
|
89 |
|
|
81 | 90 |
/** |
82 | 91 |
* Creates a HTML representations for a CDM ReferenceDTO object |
83 | 92 |
* |
Also available in: Unified diff
ref #9249, ref #9250 compact collection representation with icon link (disabled until collection page is ready)