Check if font-awsome filter is active

Check if font-awsome filter is active

by Uchendu Nwachukwu -
Number of replies: 2

Hello

I'm using font-awsome icons in a block plugin to display some icons. Currently I'm adding font-awsome like a stylesheet, which may result that it get's loaded twice if loaded by another plugin or theme (e. g. essential theme). Is there a possibility to check that in order to reduce the loading time?

Sidenote: I'm developping on a Moodle 3.1


Best regards, Uchendu

Average of ratings: -
In reply to Uchendu Nwachukwu

Re: Check if font-awsome filter is active

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

This is more of a General Developers question that a Blocks question, but this answer on Stackoverflow may help. It suggests using a local copy, providing users a way to choose a CDN. It’s clearly an answer about Wordpress, but it may give you some clues where to start.

Maybe link to this thread from the General Developers and see if anyone can help?

In reply to Jon Bolton

Re: Check if font-awsome filter is active

by Uchendu Nwachukwu -

Thank you very much for the answer Jon. That's definitely helpful! 

I came to the result that it might be the best to make a global setting where the user can decide if font-awsome should get loaded or not. In my point of view it's currently the only way that isn't described in the stackoverflow post as dirty or bad and prevents the plugin to load the css if not required.

I've now created a post in the general developer forum since I'm looking for a proper automatic solution.