|
|
|
@ -57,7 +57,8 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) {
|
|
|
|
|
|
|
|
|
|
]; |
|
|
|
|
$references['#attached']['library'][] = 'bibcite_footnotes/reference_footnote'; |
|
|
|
|
|
|
|
|
|
$dont_show_backlink_text = $config->get('filters.filter_reference_footnotes.settings.reference_dont_show_backlink_text'); |
|
|
|
|
$sort_references_by = $config->get('filters.filter_reference_footnotes.settings.reference_sort_by'); |
|
|
|
|
$serializer = \Drupal::service('serializer'); |
|
|
|
|
|
|
|
|
|
foreach ($footnotes as $fn) { |
|
|
|
@ -68,12 +69,15 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) {
|
|
|
|
|
], |
|
|
|
|
]; |
|
|
|
|
$build = []; |
|
|
|
|
preg_match('/\[bibcite_reference:(\d*)\]/', $fn['text'], $matches); |
|
|
|
|
$reference_entity_id = $matches[1]; |
|
|
|
|
|
|
|
|
|
if (!is_array($fn['ref_id'])) { |
|
|
|
|
// Output normal footnote. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$url = Url::fromUserInput('#' . $fn['ref_id'], ['attributes' => ['id' => $fn['fn_id'], 'class' => 'footnote-link']]); |
|
|
|
|
$link = Link::fromTextAndUrl($fn['value'], $url)->toRenderable(); |
|
|
|
|
$link = Link::fromTextAndUrl(($dont_show_backlink_text && $reference_entity_id ? '^' : $fn['value']), $url)->toRenderable(); |
|
|
|
|
$build[] = $link; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
@ -95,8 +99,6 @@ function bibcite_footnotes_preprocess_footnote_list(&$variables) {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
preg_match('/\[bibcite_reference:(\d*)\]/', $fn['text'], $matches); |
|
|
|
|
$reference_entity_id = $matches[1]; |
|
|
|
|
if (!empty($reference_entity_id)) { |
|
|
|
|
$reference_storage = \Drupal::entityTypeManager() |
|
|
|
|
->getStorage('bibcite_reference') |
|
|
|
|