From 4310eb9be9400c9e6c646a75517586d9d8fa9831 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Fri, 2 Nov 2018 02:46:55 -0300 Subject: [PATCH] Allow separate citation instances to have their own page numbers. --- bibcite_footnotes.module | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bibcite_footnotes.module b/bibcite_footnotes.module index 29eecaa..39c617e 100644 --- a/bibcite_footnotes.module +++ b/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']]); $link = Link::fromTextAndUrl(($footnote_link_text), $url)->toRenderable(); $build['footnote-link'] = $link; + $override_page_in_citation = $fn['page'] ? $fn['page'] : FALSE; } else { // 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++; } + $override_page_in_citation = FALSE; } if (!empty($fn['text'])) { @@ -114,7 +116,9 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) { if (!empty($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; $render = render($build); $item['#markup'] = $render;