Problem/Motivation
The 'Collapse footnotes with identical content' option works, as in that identical references don't appear multiple times in the grouped footer. There's one problem though: when an identical footnote is found in a subsequent text field, its reference isn't added to the footer again but its citation is renumbered, causing it to link to a non-existing reference.
Steps to reproduce
Add an identical footnote to a field different than the original one, with collapsing and grouping enabled.
Proposed resolution
In \Drupal\footnotes\Plugin\Filter\FootnotesFilter::getMatchingFootnoteKey(), don't just check the footnotes of the current filter. Check footnotes from the group as well.
Issue fork footnotes-3519927
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
dieterholvoet commentedComment #6
scott_euser commentedThanks @dieterholvoet for the start on this!
We have been working on a giant publication with hundreds of footnotes and we have also realised that when across multiple fields, not only is the grouping not shared for identical numbers, the matching of same text appearing in different fields does not group those still.
Working on some refactoring to share some of the FootnotesFilter code with FootnotesGroup - moved to a separate branch for now.
Seems to be working for now, but will be adding test coverage to this as its a problem that has come back too often.
Comment #7
scott_euser commentedOkay got some more automated test coverage in as well to ensure with & without grouping works okay. Will leave this here for a little bit as needs review in case anyone has any concerns
Comment #9
sbrockwell commentedThis fix seems to be working for me. I've tested using the same footnote across multiple paragraphs of different types, alongside the same footnote within one paragraph and the footnote is merged as expected across all permutations in my test case.
Comment #11
scott_euser commentedThanks for testing it out and confirming. Will be part of the next release