Note: You are currently viewing documentation for Moodle 3.11. Up-to-date documentation for the latest stable version of Moodle may be available here: FontAwesome filter.

FontAwesome filter

From MoodleDocs

This page requires updating. Please do so and remove this template when finished.


Font Awesome provides sites with scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS. Font Awesome 4.7.0 is used by Moodle core. This version is fully open source and is GPL compatible. No attribution is required when using the fonts, although the project does say it is appreciated.

This filter makes it easy to add Font Awesome icons to course content in any Moodle site. Please be sure to target any questions related to this filter to the Plugins discussion at the Moodle plugins directory, and bugs to the GitHub issues tracker.

Filter Objectives

The aim of this filter was to provide an easy and functional way for content creators to easily add Font Awesome icons anywhere in course content. If using the recommended method provide by Font Awesome which involves creating custom classes you will find that the text editor strips these out automatically as unrecognized/bad code.

This filter allows you to use Font Awesome icons in the Moodle text editor without worrying about having your div's stripped out by the Moodle Atto/TinyMCE HTML cleaner.

Requirements

Your site/theme must have Font Awesome embedded already. This filter does not provide the font.

  • Moodle 3.3 upwards

Configuration

First, activate the filter_tabs plugin in "Site Administration > Plugins > Filters > Manage filters".

Additional

filter_fontawesome has a settings page to allow you to limit the filter to only certain text-box formats.

Usage

To create Font Awesome icons in text fields, use the following syntax: [fa-*] where * is the name of the icon you wish to display. The hardest part is finding the icon you wish to use. To browse the full list of the icons, please visit this link. Once you have found the icon, you just have to surround it with a set of square brackets. e.g.:

     [fa-camera-retro]

If you have typed in the icon name correctly, you will see the icon appear once you have hit save. More examples can be found here or below.

Configurable Options

If you wish to make the icon larger, you can use a multiplier. e.g.:

[fa-camera-retro fa-2x]    or    [fa-camera-retro fa-4x]

If you wish to rotate the icon you can specify how many degrees clockwise. e.g.:

[fa-camera-retro fa-rotate-90]

You can also flip an icon horizontally or vertically. e.g.:

[fa-camera-retro fa-flip-horizontal]    or    [fa-camera-retro fa-flip-vertical]

You can mute the colour to a dull grey. e.g.:

[fa-camera-retro fa-muted]

You can "pull" the icon to the left or right. If it is "pulled" to the left text will wrap to the right. e.g.:

[fa-camera-retro pull-left]

Advanced Tip

All the settings above can be mixed and matched. For example, if I were to type in:

[fa-quote-left fa-4x pull-left fa-muted]

Use a few of the new styles together, and you've got easy pull quotes or a great introductory article image. Or spinning icons for loading and refreshing content. Or fun big icons in multi-line buttons. You can combine all of them in any combination to get many new possibilities.

You would generate:

fontawesome advancedtip.png

See also