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

load_fontawesome_icon_map web service does not respect current theme

    XMLWordPrintable

Details

    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MDL-69215-master-2
    • 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

    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

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Marina Glancy Marina Glancy
              Jun Pataleta Jun Pataleta
              Janelle Barcega Janelle Barcega
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                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