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

Theme icons are lost after web upgrade in 3.9 or theme change in other versions

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Basic testing (fontawesome icons)

      1. Enable $CFG->allowthemechangeonurl
      2. Open site in boost theme
      3. Purge caches
      4. Add ?theme=classic to the URL
      5. Expand "Site pages" in the navigation block
      6. Verify that you see the squares next to each item
      7. Take a screenshot of the navigation block.

      Basic testing (image icons)

      1. Edit these two files: theme/classic/config.php and theme/boost/config.php and add this line at the end of them:

        $THEME->iconsystem = \core\output\icon_system::STANDARD;
        

        (that will force image icons to be used both by classic and boost)

      2. Repeat steps 1-6 from previous section.
      3. Verify that there aren't missing icons in the navigation or administration blocks.
      4. Compare the 2 screenshots and verify that the icons used are different (squares are smaller with image icons and, in general they are "gray" instead of "black").

      Some more testing (image icons).

      1. Go to a course and turn editing on.
      2. Verify that the "Edit menus", both the section and activity ones show the options each one with one icon.
      3. Click on "Add and activity or resource", the activity chooser will appear.
      4. Verify that every activity has an "information" little icon (again, gray). Note that there is also an square/missing icon on the left of the information icons, that's a known issue that will be fixed @ MDL-67992.
      5. Select the "label" resource, the "adding a new label" form will be shown.
      6. Verify that the editor is shown and all the icons on it are displayed ok.
      7. Add to the URL "&theme=boost"
      8. The "adding new label" form will be refreshed.
      9. Verify that the editor is shown and all the icons on it are displayed ok.

      Other testing.

      1. Revert changes from theme/*/config.php
      2. Edit file theme/classic/classes/output/icon_system_fontawesome.php and add $iconmap['core:i/star'] = 'fa-square'; close to the end of file (before you return $iconmap).
      3. Purge caches, switch to classic theme
      4. Login as a user who is enrolled into some courses (or enrol yourself if you are an admin)
      5. Go to your dashboard and "Star" some courses, make sure the square is displayed instead of a star
      6. Refresh the page, you should not see any stars but squares instead
      Show
      Basic testing (fontawesome icons) Enable $CFG->allowthemechangeonurl Open site in boost theme Purge caches Add ?theme=classic to the URL Expand "Site pages" in the navigation block Verify that you see the squares next to each item Take a screenshot of the navigation block. Basic testing (image icons) Edit these two files: theme/classic/config.php and theme/boost/config.php and add this line at the end of them: $THEME->iconsystem = \core\output\icon_system::STANDARD; (that will force image icons to be used both by classic and boost) Repeat steps 1-6 from previous section. Verify that there aren't missing icons in the navigation or administration blocks. Compare the 2 screenshots and verify that the icons used are different (squares are smaller with image icons and, in general they are "gray" instead of "black"). Some more testing (image icons). Go to a course and turn editing on. Verify that the "Edit menus", both the section and activity ones show the options each one with one icon. Click on "Add and activity or resource", the activity chooser will appear. Verify that every activity has an "information" little icon (again, gray). Note that there is also an square/missing icon on the left of the information icons, that's a known issue that will be fixed @ MDL-67992 . Select the "label" resource, the "adding a new label" form will be shown. Verify that the editor is shown and all the icons on it are displayed ok. Add to the URL "&theme=boost" The "adding new label" form will be refreshed. Verify that the editor is shown and all the icons on it are displayed ok. Other testing. Revert changes from theme/*/config.php Edit file theme/classic/classes/output/icon_system_fontawesome.php and add $iconmap ['core:i/star'] = 'fa-square'; close to the end of file (before you return $iconmap). Purge caches, switch to classic theme Login as a user who is enrolled into some courses (or enrol yourself if you are an admin) Go to your dashboard and "Star" some courses, make sure the square is displayed instead of a star Refresh the page, you should not see any stars but squares instead
    • Affected Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull 3.8 Branch:
      MDL-69109-38-2
    • Pull Master Branch:
      MDL-69109-master-2

      Description

      This took a long time to debug, I managed to reproduce on vanilla Moodle. This affects Workplace theme a lot, all our icons are lost after each web upgrade.

      To reproduce on vanilla Moodle:

      1. Switch theme to Classic (Site administration>Appearance>Themes>Theme selector)
      2. Expand "Site pages" in the navigation block, you will see a big square next to each item
      3. Bump version of any plugin or install any plugin using web interface
      4. Expand "Site pages" in the navigation block, the big square has disappeared
      5. Purge caches
      6. Expand "Site pages" again - icons are back

      The Classic theme only overrides one core font-awesome mapping - the navigation item. But Workplace theme overrides a lot of icons and the UI is completely broken after each upgrade

      Lots of debugging led me to the page /admin/index.php?cache=0&confirmrelease=1&confirmplugincheck=1 that calls the WS request to core_output_load_fontawesome_icon_map. This request, for some reason, calls method get_icon_name_map() from the instance of the base class core\output\icon_system_fontawesome instead of theme_classic\output\icon_system_fontawesome. This results in the theme icons being lost.

      Then the result is cached and the site remains in the broken state until the next cache purge.

        Attachments

        1. activity_chooser_with_standard_icons.png
          activity_chooser_with_standard_icons.png
          50 kB
        2. activityinfo.png
          activityinfo.png
          240 kB
        3. blueblocks.png
          blueblocks.png
          64 kB
        4. noicon.png
          noicon.png
          65 kB
        5. Screenshot_1.png
          Screenshot_1.png
          56 kB
        6. Screenshot_2.png
          Screenshot_2.png
          125 kB
        7. Screenshot 2020-06-22 at 14.41.31.png
          Screenshot 2020-06-22 at 14.41.31.png
          25 kB
        8. Screenshot 2020-06-22 at 14.45.24.png
          Screenshot 2020-06-22 at 14.45.24.png
          174 kB
        9. Screenshot 2020-06-22 at 14.45.48.png
          Screenshot 2020-06-22 at 14.45.48.png
          23 kB
        10. test3_classic_theme_with_standard_icons.png
          test3_classic_theme_with_standard_icons.png
          26 kB
        11. test4_starred_courses.png
          test4_starred_courses.png
          156 kB
        12. unstarred.png
          unstarred.png
          67 kB

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              Eloy Lafuente (stronk7)
              Integrator:
              Andrew Nicols
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Bas Brands
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jul/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days
                  2d