Browse Source

WIP

mla_citations
Alexander O'Neill 6 years ago
parent
commit
811dc88268
  1. 15
      bibcite_footnotes.module
  2. 16
      templates/footnote-link.html.twig
  3. 2
      templates/footnote-list.html.twig

15
bibcite_footnotes.module

@ -135,6 +135,16 @@ function _bibcite_footnotes_reference_array_cmp($a, $b) {
return strcmp($a1, $b1); return strcmp($a1, $b1);
} }
function bibcite_footnotes_preprocess_footnote_link(&$variables) {
// $variables['fn']['fn']['#type'] = 'markeup';
// $variables['fn']['fn']['#markup'] = '<h2>Hello!</h2>';
$fn = $variables['fn']['fn'];
$url = Url::fromUserInput('#' . $fn['ref_id'], ['attributes' => ['id' => $fn['fn_id'], 'class' => 'footnote-link']]);
$link = Link::fromTextAndUrl(($dont_show_backlink_text && $reference_entity_id ? '^' : $fn['value']), $url)->toRenderable();
$build[] = $link;
}
/** /**
* Implements hook_theme(). * Implements hook_theme().
*/ */
@ -148,11 +158,14 @@ function bibcite_footnotes_theme() {
function bibcite_footnotes_theme_registry_alter(&$theme_registry) { function bibcite_footnotes_theme_registry_alter(&$theme_registry) {
unset($theme_registry['footnote_list']['function']); unset($theme_registry['footnote_list']['function']);
// $theme_registry['footnote_list']['function'] = 'bibcite_footnotes_theme_footnote_list';
$theme_registry['footnote_list']['path'] = drupal_get_path('module', 'bibcite_footnotes') . '/templates'; $theme_registry['footnote_list']['path'] = drupal_get_path('module', 'bibcite_footnotes') . '/templates';
$theme_registry['footnote_list']['template'] = 'footnote-list'; $theme_registry['footnote_list']['template'] = 'footnote-list';
$theme_registry['footnote_list']['variables']['notes'] = []; $theme_registry['footnote_list']['variables']['notes'] = [];
$theme_registry['footnote_list']['variables']['references'] = []; $theme_registry['footnote_list']['variables']['references'] = [];
$theme_registry['footnote_list']['variables']['footnotes'] = []; $theme_registry['footnote_list']['variables']['footnotes'] = [];
unset($theme_registry['footnote_link']['function']);
$theme_registry['footnote_link']['path'] = drupal_get_path('module', 'bibcite_footnotes') . '/templates';
$theme_registry['footnote_link']['template'] = 'footnote-link';
} }

16
templates/footnote-link.html.twig

@ -0,0 +1,16 @@
{#
/**
* @file footnote-link.html.twig
* Default theme implementation to present an inline reference footnote link.
*
* Available variables:
* - fn: Components of the footnote
* - link: Rendered link.
* - attributes: HTML attributes for the container element.
*
* @see template_preprocess_footnote_link().
*
* @ingroup themeable
*/
#}
{{ fn }}

2
templates/footnote-list.html.twig

@ -17,5 +17,5 @@
<div{{ attributes.addClass('footnote-list') }}> <div{{ attributes.addClass('footnote-list') }}>
{{ notes }} {{ notes }}
{{ references }} {{ references }}
</div> </div>

Loading…
Cancel
Save