Alexander O'Neill 6 years ago
parent
commit
a399f6d9c1
  1. 2
      bibcite_footnotes.module
  2. 20
      src/Plugin/Filter/ReferenceFootnotesFilter.php

2
bibcite_footnotes.module

@ -63,7 +63,7 @@ function bibcite_footnotes_help($route_name, RouteMatchInterface $route_match) {
function bibcite_footnotes_preprocess_bibcite_footnote_list(&$variables) {
$config = $variables['config'];
$footnotes = $variables['notes'];
ksm($footnotes);
$notes = [
'#theme' => 'item_list',
'#list_type' => 'ul',

20
src/Plugin/Filter/ReferenceFootnotesFilter.php

@ -10,7 +10,7 @@ use Drupal\footnotes\Plugin\Filter\FootnotesFilter;
* Provides a base filter for Reference Footnotes filter.
*
* @Filter(
* id = "filter_reference_footnotes",footnote_list
* id = "filter_reference_footnotes",
* module = "bibcite_footnotes",
* title = @Translation("Reference Footnotes filter"),
* description = @Translation("You can insert footnotes directly into texts."),
@ -141,16 +141,16 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
}
if ($op == 'output footer') {
if ($this->settings['footnotes_ibid']) {
$this->ibidemify($store_matches);
}
if (count($store_matches) > 0) {
// Separate out endontes and reference notes.
$notes = $this->extractNotesByType(self::ENDNOTE, $store_matches);
$references = $this->extractNotesByType(self::REFERENCE, $store_matches);
if ($this->settings['footnotes_ibid']) {
$this->ibidemify($references);
}
// Only if there are stored fn matches, pass the array of fns to be
// themed as a list
$markup = [
@ -330,19 +330,15 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
protected function ibidemify(&$footnotes) {
$prev_reference_id = FALSE;
foreach ($footnotes as $index => $fn) {
if (!empty($fn['text'])) {
$prev_reference_id = FALSE;
continue;
}
if ($prev_reference_id) {
if ($fn['reference'] == $prev_reference_id) {
unset($footnotes[$index]['reference']);
$footnotes[$index]['text'] = $this->t('Ibid.');
$footnotes[$index]['text'] = 'Ibid.';
$footnotes[$index]['text_clean'] = 'Ibid.';
continue;
}
}
$prev_reference_id = $fn['reference']; // Could be empty, that's OK.
$prev_reference_id = $fn['reference'];
}
}

Loading…
Cancel
Save