Font Awesome

Font Awesome

by Steve Kotyk -
Number of replies: 12

This may be a silly question, but here it goes.

I am putting a Font Awesome howto together for my moodle site, I want to insert the {fa-bullhorn} code into my page without having the filter change the code to an icon.

I have tried &#91 & &#93 with no luck, I also tried <pre> & <code>.

 

Any ideas? 

Average of ratings: -
In reply to Steve Kotyk

Re: Font Awesome

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Use the human-in-the-loop method and write the instructions such that you don't write exactly {fa-bullhorn} but tell them what to type.  So say you need to have an opening curly bracket '{' followed by 'fa-' then the icon of your choice by looking at ... followed by a closing curly bracket '}'.

In reply to Gareth J Barnard

Re: Font Awesome

by Steve Kotyk -

Fair enough, I would like to do something like on Moodleman.net.

 

http://moodleman.net/articles/using-fontawesome-moodle/

Average of ratings: Useful (1)
In reply to Steve Kotyk

Re: Font Awesome

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

If Mary's interesting solution does not work, then it looks like Julian has used images in his post.  So you could do the same.

In reply to Steve Kotyk

Re: Font Awesome

by Julian Ridden -

If you are happy to install the filter it really does make things very easy for users. And the documentation is already out there.

 

The filter is here https://moodle.org/plugins/view.php?plugin=filter_fontawesome

Documentation with samples is here  http://docs.moodle.org/25/en/FontAwesome_filter

And, of course, the blog post you mentioned http://moodleman.net/articles/using-fontawesome-moodle/

Julian

Average of ratings: Useful (1)
In reply to Steve Kotyk

Re: Font Awesome

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

If you are writing instructions using the Text Editor in a Moodle course and want to add the correct way to add the Font Awesome icons then you need to write the code, highlight it and then CLICK on the  ('Prevent auto linking') icon in your Text Editor menu. This in turn adds a span tag around the code and looks like this...

<span class="nolink">{fa-bullhorn}</span>

...if you view the HTML using the   tab in the menu

That SHOULD prevent it being converted. If not then try...

Going into the HTML part of the editor and add this &#123;fa-bullhorn&#125;

which will convert to this {fa-bullhorn}.

Hope this helps?

Mary

In reply to Mary Evans

Re: Font Awesome

by Steve Kotyk -

In the HTML editor i added:

<span class="nolink">&#93;fa-thumbs-up&#93;</span>

Saved it, then in the WYSIWYG editor i see [fa-bullhorn].

But i still get the icon in the post.

 

In reply to Steve Kotyk

Re: Font Awesome

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

In that case create an image and add that instead.

fontawesome

In reply to Mary Evans

Re: Font Awesome

by Steve Kotyk -

After looking at the source for his website, it looks like he is not using the font awesome filter on his site.  So the [fa-bullhorn] is just text, and the corresponding icons are images.

 

I wonder if there is a way to disable or toggle the filter on a specific page?

In reply to Steve Kotyk

Re: Font Awesome

by Paul Nicholls -

Within each module (either when viewing or updating an existing module) you should be able to configure filters for just that module by going to [module name] administration -> Filters.  That should present you with a list of filters, and a dropdown box to choose whether to inherit, force on or force off each filter.  For labels, since there's no "view" mode other than seeing them inline in the course, you'll need to be in the edit/update mode to get the "Label administration" menu.  You can likewise enable/disable filters at other context levels, such as at the course level (Course administration -> Filters), if desired.

If you'd like to be able to list both the code/token and the resulting icon in one label (or Page, or whatever else), it might be easiest to just use images for the actual icons (though it may also be possible to hard-code the Font Awesome icons into it - I haven't tried the FA filter so I'm not sure what's possible).

In reply to Paul Nicholls

Re: Font Awesome

by Steve Kotyk -

Thanks Paul. that's an obvious solution I wish I came up with thatsmile

I appreciate your help!

In reply to Steve Kotyk

Re: Font Awesome

by Danny Wahl -

In WordPress they have a universal shortcode escape which is a second set of brackets.  We could write this into the plugin, or write a secondary "escape" filter.so that

[ [ filter ] ] actually outputs [ filter ] (I hope this doesn't get filtered)

In reply to Danny Wahl

Re: Font Awesome

by Steve Kotyk -

Disabling the filter is not the solution as it turns out, when I disable the filter on the forum where I am writing this how to, all the font awesome icons in the blocks and footer turn to code.

It sounds like an escape method would be choice, anybody have experience with this?