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

Add native FontAwesome support to pix_icon class

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5
    • Fix Version/s: None
    • Component/s: HTML and CSS, Themes
    • Labels:
      None
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      When creating a new pix_icon instance, you are only able to pass a pix path (e.g. i/calendar) to it. Later, when the pix_icon is rendered in a theme

      • if the theme is using icon_system_standard, this pix is output directly as an img tag
      • if the theme is using icon_system_fontawesome, this pix mapped to a FontAwesome icon and the pix is output as FontAwesome icon tag.

      This approach is fine for backwards-compatibility, but it has three main downsides for developments which only target FontAwesome-capable themes like Boost and Boost Child themes:
      1. When creating a new pix_icon instance, you always have to pass a pix path first and have the create an additional FontAwesome mapping which is a code overhead.
      2. The pix file is expected to exist on disk, even if it is never rendered in the theme, which is also an overhead.
      3. The pix file should cohere visually with the mapped FontAwesome icon which isn't always possible without creating new icon files (which will never be rendered as mentioned in 2.)

      That's why I would like to propose to add native FontAwesome support to the pix_icon class to simplify the work with FontAwesome icons in themes like Boost.

      This is especially relevant in code areas where I must use pix_icons (e.g. when adding an icon to a navigation_node instance) and cannot use a custom icon rendering mechanism.


      TL,DR:
      As a developer working on code for a FontAwesome-capable theme like Boost and Boost Child Themes, I want to be able to use FontAwesome identifiers like "fa-check" when creating a pix_icon instance without having to add any pix fallbacks which will never be rendered in my theme.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                abias Alexander Bias
                Participants:
                Component watchers:
                Amy Groshek, David Scotson, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Bas Brands, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                3 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: