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

load_fontawesome_icon_map web service does not respect current theme

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.8.3, 3.9.1
    • Fix Version/s: 3.8.5, 3.9.2
    • Component/s: Themes
    • Labels:
    • Testing Instructions:
      Hide
      1. Open Site administration -> Appearance -> Themes -> Theme settings
      2. Enable allowcoursethemes
      3. Open a course (any will do). Let's call this course "Course A"
      4. Edit settings
      5. Set "Appearance -> Force theme" to "Classic"
      6. Edit theme/classic/classes/output/icon_system_fontawesome.php in your preferred editor
      7. Add the following line in the function "get_core_icon_map()" just right before the return statement:

        $iconmap['core:docs'] = 'fa-square';
        

      8. Purge caches
      9. Open the course again
      10. Turn editing on
      11. Click "Add an activity or resource"
        1. Confirm that under each activity is a Star, and a filled square box icon
      12. Open another course (using the Boost theme). Let's call this course "Course B"
      13. Click "Add an activity or resource"
        1. Confirm that under each activity is a Star, and an [i] icon
      14. Edit theme/classic/config.php
      15. At the bottom of the file add:

        $THEME->iconsystem = \core\output\icon_system_standard::class;
        

      16. Purge caches
      17. Visit Course B again
      18. Click "Add an activity or resource"
      19. Inspect the "Star" icon underneath any activity
        1. Confirm that the star is in an "<i>" tag
      20. Visit Course A again
      21. Click "Add an activity or resource"
      22. Inspect the "Star" icon underneath any activity
        1. Confirm that the star is in an "<img>" tag
      Show
      Open Site administration -> Appearance -> Themes -> Theme settings Enable allowcoursethemes Open a course (any will do). Let's call this course " Course A " Edit settings Set "Appearance -> Force theme" to "Classic" Edit theme/classic/classes/output/icon_system_fontawesome.php in your preferred editor Add the following line in the function " get_core_icon_map() " just right before the return statement: $iconmap['core:docs'] = 'fa-square'; Purge caches Open the course again Turn editing on Click "Add an activity or resource" Confirm that under each activity is a Star, and a filled square box icon Open another course (using the Boost theme). Let's call this course " Course B " Click "Add an activity or resource" Confirm that under each activity is a Star, and an [i] icon Edit theme/classic/config.php At the bottom of the file add: $THEME->iconsystem = \core\output\icon_system_standard::class; Purge caches Visit Course B again Click "Add an activity or resource" Inspect the "Star" icon underneath any activity Confirm that the star is in an " <i> " tag Visit Course A again Click "Add an activity or resource" Inspect the "Star" icon underneath any activity Confirm that the star is in an " <img> " tag
    • Affected Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull 3.8 Branch:
    • Pull 3.9 Branch:
      MDL-69215-39-2
    • Pull Master Branch:
      MDL-69215-master-2

      Description

      The classic theme extends the boost theme and overrides the fontawesome icon system class. It defines that extension in theme/classic/config.php:

      $THEME->iconsystem = '\\theme_classic\\output\\icon_system_fontawesome';
      

      However when the theme fetches the icon data via the web service, it calls:

      $instance = icon_system::instance(icon_system::FONTAWESOME);
      

      It completely ignores the theme setting for both the current site theme, and the current theme for the current context (i.e. course, category, and cohort themes) and the current user preference.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Peer reviewer:
              Marina Glancy
              Integrator:
              Jun Pataleta
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Bas Brands
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 1 hour, 57 minutes
                  1d 1h 57m