Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-68182

Themes cannot safely specify fontawesome icon replacements as cache is shared across themes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.8.2
    • Themes
    • None
    • MOODLE_38_STABLE

      Themes that use and override the core Fontawesome icon system cannot specify own replacements. If they do, it is possible that custom replacements will be ignored.

      get_core_icon_map defines an array of replacements (in the form of Moodle pix icon --> fontawesome glyph): https://github.com/moodle/moodle/blob/5548689ead64b57d43ac9bf4bd996380b0ff9049/lib/classes/output/icon_system_fontawesome.php#L53

      These (and additional) replacements are cached by get_icon_name_map, which calls get_core_icon_map only if the cache is empty: https://github.com/moodle/moodle/blob/5548689ead64b57d43ac9bf4bd996380b0ff9049/lib/classes/output/icon_system_fontawesome.php#L440

      It seems that sometimes the cache is built by the core icon_system_fontawesome, maybe via Boost. Whenever that happens, subclasses have no way of adding their own replacements, resulting in output errors as in the screenshot that I will attach.

      This does not only affect custom themes. There is an override in core theme_classic that should suffer from the same situation: https://github.com/moodle/moodle/blob/73f8c56dfca5dd4028845f1fbbaac0a83e43caf9/theme/classic/classes/output/icon_system_fontawesome.php#L44

      Workaround: Themes that rely on this have to write their own cache definition and take care of creating that cache themselves. Example: https://github.com/learnweb/moodle-theme_wwu2019/commit/d7402dfc15abc1bf3c601773b96b04a498102cc1

        1. a.png
          6 kB
          Jan Dageförde

            Unassigned Unassigned
            jan.dagefoerde Jan Dageförde
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.