footnotes.css not loaded when both Use footnotes CSS and Open footnote references in a dialog options are selected

Created on 10 July 2024, 8 days ago

Problem/Motivation

When both "Use footnotes CSS" and "Open footnote references in a dialog" options are selected, only the footnotes.dialog library is added.

Steps to reproduce

In the configuration options for the Footnotes filter, select both "Use footnotes CSS" and "Open footnote references in a dialog".

Proposed resolution

I believe this is happening due to the way the libraries are being added via the Attachments trait. When "Use footnotes CSS" is selected, this code snippet adds the library in FootnotesFilter.php.

    // Only use CSS if option is selected.
    if (!isset($this->settings['footnotes_css']) || $this->settings['footnotes_css']) {
      $result->setAttachments([
        'library' => [
          'footnotes/footnotes',
        ],
      ]);
    }

However, if "Open footnote references in a dialog" is also selected, that snippet is immediately overwritten by this:

    // Only use dialog if option is select.
    if (isset($this->settings['footnotes_dialog']) && $this->settings['footnotes_dialog']) {
      $result->setAttachments([
        'library' => [
          'footnotes/footnotes.dialog',
        ],
      ]);

The two libraries need to be attached in such a way that they don't overwrite each other. This can be done by using addAttachments instead of setAttachments.

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Footnotes

Created by

πŸ‡ΊπŸ‡ΈUnited States jesss

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024