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