Remapping fontawesome icons in a plugin

Remapping fontawesome icons in a plugin

על ידי Mike Churchward בתאריך
מספר תגובות: 2
תמונה של Core developers תמונה של Particularly helpful Moodlers תמונה של Plugin developers תמונה של Testers

I'm having issues providing custom fontawesome icons in my plugin. The instructions describe that you can provide an icon in your plugin pix directory, provide a get_fontawesome_icon_map callback in your plugin lib.php, and then use it in a mustache template with the {{#pix}} helper. But it just does not seem to work.

The example shows how the forum module does it. But looking at what it does and what the actual output is, seems that it doesn't work there either.

For example, the forum remaps the 'fa-map-pin' to its own image through these lines of code:

But in practice (for example in these forums), the pin icon that is shown, is not the one that is in the forum pix directory. It's the standard one.

This is the image that is being requested:
Requested image
This is the image that is displayed:
Actual image

Shouldn't the one that was mapped be the one that is shown? What am I misunderstanding?

ממוצע דרוגים: -
בתגובה ל: Mike Churchward

Re: Remapping fontawesome icons in a plugin

על ידי Gareth Barnard בתאריך
תמונה של Core developers תמונה של Particularly helpful Moodlers תמונה של Plugin developers
? But the icon being displayed is the Font Awesome one -> https://fontawesome.com/v4.7.0/icon/map-pin - thus the callback is working correctly for when a theme supports FontAwesome.  If not then the icon in the forum pix folder would be shown (unless the theme implemented its own icon system).