Browse Source

Allow separate citation instances to have their own page numbers.

ibidem
Alexander O'Neill 6 years ago
parent
commit
4310eb9be9
  1. 6
      bibcite_footnotes.module

6
bibcite_footnotes.module

@ -76,6 +76,7 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) {
$url = Url::fromUserInput('#' . $fn['ref_id'], ['attributes' => ['id' => $fn['fn_id'], 'class' => 'footnote-link']]); $url = Url::fromUserInput('#' . $fn['ref_id'], ['attributes' => ['id' => $fn['fn_id'], 'class' => 'footnote-link']]);
$link = Link::fromTextAndUrl(($footnote_link_text), $url)->toRenderable(); $link = Link::fromTextAndUrl(($footnote_link_text), $url)->toRenderable();
$build['footnote-link'] = $link; $build['footnote-link'] = $link;
$override_page_in_citation = $fn['page'] ? $fn['page'] : FALSE;
} }
else { else {
// Output footnote that has more than one reference to it in the body. // Output footnote that has more than one reference to it in the body.
@ -93,6 +94,7 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) {
$i++; $i++;
} }
$override_page_in_citation = FALSE;
} }
if (!empty($fn['text'])) { if (!empty($fn['text'])) {
@ -114,7 +116,9 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) {
if (!empty($reference_entity_id)) { if (!empty($reference_entity_id)) {
$citation_build = $citation_tools->getRenderableReference($reference_entity_id); $citation_build = $citation_tools->getRenderableReference($reference_entity_id);
if ($override_page_in_citation) {
$citation_build['#data']['page'] = $override_page_in_citation;
}
$build[] = $citation_build; $build[] = $citation_build;
$render = render($build); $render = render($build);
$item['#markup'] = $render; $item['#markup'] = $render;

Loading…
Cancel
Save