Automatic numbering with multiple text areas not working

Created on 23 February 2024, about 1 year ago
Updated 19 March 2024, about 1 year ago

Problem/Motivation

When using the group option (filter: "Disable output of the footnotes footer"), and automatic numbering if you have say 4 text blocks with one footnote/citation each, you get each one to be [1] and the actual footnotes block looks a bit silly/confusing everything is the same number.

Steps to reproduce

  • activate `Disable output of the footnotes footer`
  • In a paragraph/layout builder context and multiple text blocks with one (or more) footnotes each leaving it at automatic numbering
  • Render page and footnotes
  • Observe that all have the same number

Proposed resolution

Add a count method to the footnotes group class and check that.

I'm not 100% sure this is the best method, but it solves it for my use case, so putting it up for review anyways.

Remaining tasks

Testing? decide on plan?

🐛 Bug report
Status

Fixed

Version

4.0

Component

Footnotes

Created by

🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @nickdickinsonwilde
  • Merge request !36Update 2 files → (Merged) created by nickdickinsonwilde
  • Pipeline finished with Success
    about 1 year ago
    Total: 234s
    #102756
  • 🇬🇧United Kingdom scott_euser

    Thanks for looking into this! Can you check if without the patch that any of your blocks are lazy loaded? If so you may need the 'Support for ajax loaded citations' bit mentioned on the homepage.

    Another possibility is that you don't have this bit from the homepage in place "Set the block configuration for 'Current entity context for caching' to 'Node from URL'". If you could check/confirm those two options please

  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Almost certainly lazy loaded - do have bigpipe enabled. On the homepage I just see

    Separate footnote references block (optional) to output the citations via JavaScript instead of PHP in the case that footnotes may be loaded via ajax (eg, BigPipe, Views Ajax, etc)

    Beyond placing it is there anything needed?

    Adding it to my node via preprocess

      $footnotes = \Drupal::service('plugin.manager.block')->createInstance('footnotes_group', []);
      $variables['content']['custom_block_output'] = $footnotes->build();
    

    Will investigate the caching options.

  • 🇬🇧United Kingdom scott_euser

    Ah sorry I can see that needs better documentation in case your are programmatically creating the block. If you add the block via the UI it's lazy loaded as well and has an option ''Group footnotes using JavaScript" which gets triggered to also watch for new footnotes appearing on ajax load completions.

  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Just did it via the block UI instead and that is still getting wrong automatic numbers - it is getting all the numbers correctly and collecting them - it is just each text block/ckeditor area resets to 1.
    ex:

    The links do point to the correct spots, just the numbers reset each text field.

  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Note, this is being used with Layout Paragraphs (but all paragraphs on the same node/field), so chance that is impacting it versus straight paragraphs but I don't think so.

  • 🇬🇧United Kingdom scott_euser

    Okay thanks for the info, curious to figure this one out and get test coverage for it. I'll see if I can reproduce as well. I do like Layout Paragraphs as well, solid UI, have not played with it for a while so a good opportunity :)

  • 🇬🇧United Kingdom scott_euser

    Yes I can see this happening in Layout Paragraphs. MR on the way

  • Status changed to Needs review about 1 year ago
  • 🇬🇧United Kingdom scott_euser

    So the Footnotes All Block JS was having two issues:

    1. It was expecting the 'Disable output of the footnotes footer' to be unchecked and 'move' the multiple footnotes to the single group -> now it does that separately
    2. It was removing the group if nothing was found, but then in subsequent ajax loads if new footnotes would exist, the group would be gone -> now it hides instead of removes (and unhides if found)
  • 🇬🇧United Kingdom scott_euser

    Okay, I think your branch does not hurt either to try to get it right without the JS. With lazy builder stuff in some setups will need the fixed JS. Unless I hear otherwise from you, I will merge both branches next week. Thanks!

  • Pipeline finished with Skipped
    about 1 year ago
    #111464
  • Pipeline finished with Skipped
    about 1 year ago
    #111467
  • 🇬🇧United Kingdom scott_euser

    Okay, going to give up on cspell for now until #3423402: Document how to use the CSPELL job provides some clarity. Anyways they are warnings not failures.

  • Pipeline finished with Skipped
    about 1 year ago
    #111796
    • scott_euser committed 09882ad5 on 4.0.x
      Issue #3423588: Automatic numbering with multiple text areas not working
      
  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024