|
|
|
@ -147,15 +147,17 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
|
|
|
|
|
|
|
|
|
|
if (count($store_matches) > 0) { |
|
|
|
|
// Separate out endontes and reference notes. |
|
|
|
|
$notes = $this->extractNotesByType(self::NOTES, $store_matches); |
|
|
|
|
$references = $this->extractNotesByType(self::REFERENCES, $store_matches); |
|
|
|
|
$notes = $this->extractNotesByType(self::ENDNOTE, $store_matches); |
|
|
|
|
$references = $this->extractNotesByType(self::REFERENCE, $store_matches); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Only if there are stored fn matches, pass the array of fns to be |
|
|
|
|
// themed as a list |
|
|
|
|
$markup = [ |
|
|
|
|
'#theme' => 'footnote_list', |
|
|
|
|
'#footnotes' => $store_matches, |
|
|
|
|
'#theme' => 'bibcite_footnote_list', |
|
|
|
|
'#footnotes' => $notes,, |
|
|
|
|
'#note_type' => self::ENDNOTE, |
|
|
|
|
'#config' => $this->settings, |
|
|
|
|
]; |
|
|
|
|
$str = \Drupal::service('renderer')->render($markup, FALSE); |
|
|
|
|
} |
|
|
|
@ -256,7 +258,7 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
|
|
|
|
|
// Drupal 7 requires we use "render element" which just introduces a wrapper |
|
|
|
|
// around the old array. |
|
|
|
|
$fn = [ |
|
|
|
|
'#theme' => 'footnote_link', |
|
|
|
|
'#theme' => 'bibcite_footnote_link', |
|
|
|
|
'fn' => $fn, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
@ -338,8 +340,22 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function extractNotesByType($type, $footnotes) { |
|
|
|
|
$notes = []; |
|
|
|
|
foreach ($footnotes as $fn) { |
|
|
|
|
|
|
|
|
|
switch ($type) { |
|
|
|
|
case self::ENDNOTE: |
|
|
|
|
if (!empty(fn['text'])) { |
|
|
|
|
$notes[] = $fn; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case self::REFERENCE: |
|
|
|
|
if (!empty($fn['reference'])) { |
|
|
|
|
$notes[] = $fn; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
ksm($fn); |
|
|
|
|
} |
|
|
|
|
return $notes; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|