Revision e7f3789b
Added by Andreas Kohlbecker over 3 years ago
modules/cdm_dataportal/theme/cdm_dataportal.references.theme | ||
---|---|---|
32 | 32 |
* - doIconLink: |
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 |
* - referenceStyle: the value "zoology" will cause a specific rendeting of the |
|
36 |
* reference suitable for zoological publications. |
|
37 | 35 |
* |
38 | 36 |
* @return string |
39 | 37 |
* the markup for the reference |
40 | 38 |
* |
41 | 39 |
* @ingroup themeable |
42 | 40 |
*/ |
43 |
function theme_cdm_reference($variables) { |
|
44 |
$reference = $variables['reference']; |
|
45 |
$microReference = $variables['microReference']; |
|
46 |
$doTextLink = $variables['doTextLink']; |
|
47 |
$doIconLink = $variables['doIconLink']; |
|
48 |
$referenceStyle = $variables['referenceStyle']; |
|
49 |
|
|
50 |
if (!isset($reference->authorship)) { |
|
51 |
$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid); |
|
52 |
} |
|
53 |
else { |
|
54 |
$author_team = $reference->authorship; |
|
55 |
} |
|
56 |
if ($referenceStyle == "zoology") { |
|
57 |
$year = ''; |
|
58 |
if (isset($reference->datePublished)) { |
|
59 |
$year = timePeriodToString($reference->datePublished, true, 'YYYY'); |
|
60 |
} |
|
61 |
$citation = $author_team->titleCache . (!empty($year) ? '. ' . $year : ''); |
|
62 |
} |
|
63 |
else { |
|
64 |
$citation = $reference->titleCache; |
|
65 |
} |
|
41 |
function cdm_reference_markup($reference, $microReference = NULL, $doTextLink = FALSE, $doIconLink = FALSE) { |
|
66 | 42 |
|
67 |
$citation = trim($citation);
|
|
43 |
$citation = trim($reference->titleCache);
|
|
68 | 44 |
$iconlink = ""; |
69 | 45 |
if((isset($doIconLink) && $doIconLink === TRUE)) { |
70 | 46 |
$iconlink = l(custom_icon_font_markup('icon-interal-link-alt-solid', array('class' => array('superscript'))), path_to_reference($reference->uuid), array('html' => true)); |
... | ... | |
174 | 150 |
$out = ''; |
175 | 151 |
|
176 | 152 |
if (isset($source->citation)) { |
177 |
$out .= theme('cdm_reference', [ |
|
178 |
'reference' => $source->citation, |
|
179 |
'microReference' => $source->citationMicroReference, |
|
180 |
'doIconLink' => $do_link_to_reference, |
|
181 |
]); |
|
153 |
$out .= cdm_reference_markup($source->citation, $source->citationMicroReference, false, $do_link_to_reference); |
|
182 | 154 |
} |
183 | 155 |
if(isset($source->cdmSource)){ |
184 | 156 |
$out .= render_cdm_entity_link($source->cdmSource); |
Also available in: Unified diff
refactoring theme_cdm_reference to cdm_reference_markup