Open main menu

Extension:FontAwesome

MediaWiki extensions manual
OOjs UI icon advanced.svg
FontAwesome
Release status: stable
Implementation Parser function , Skin
Description FontAwesome icons for MediaWiki
Author(s) Stephan Gambke (F.trotttalk)
Latest version 1.0 (2019-10-20)
Compatibility policy master
MediaWiki 1.31+
PHP 7.0+
Database changes No
Composer mediawiki/font-awesome
License GNU General Public License 3.0 or later
Download
README
$wgFaRenderMode
Translate the FontAwesome extension if it is available at translatewiki.net
Check usage and version matrix.

The FontAwesome extension for MediaWiki provides parser functions to insert Font Awesome Free icons into the wiki text.

Currently Font Awesome Free, version 5.11.2 is included.

RequirementsEdit

  • PHP 7.0 or later
  • MediaWiki 1.31 or later

InstallationEdit

Using ComposerEdit

Using Composer is the recommended way to install this extension.

Run the following commands from the MediaWiki installation directory:

  1. COMPOSER=composer.local.json php composer.phar require --no-update mediawiki/font-awesome ^1.0
  2. php composer.phar update --no-dev mediawiki/font-awesome

To update the extension run the last command again.

Using a download from GitHubEdit

  1. Download a tar ball or zip file from GitHub
  2. Extract it into the extensions directory of your MediaWiki installation
  3. Rename the folder mw-font-awesome-... to FontAwesome

To update the extension delete the FontAwesome folder completely and re-install.

ActivationEdit

Add the following line to your LocalSettings.php:

wfLoadExtension( 'FontAwesome' );

ConfigurationEdit

There are two render modes available for FontAwesome icons:

  • Web Fonts with CSS: This implementation uses web fonts as the file format and relies on the browser to render icons as it would any custom font.
  • SVG with JavaScript: This implementation encodes icon data and the mechanism to display them in the browser in JavaScript code that the browser executes.

The render mode can be selected by setting the variable $wgFaRenderMode in LocalSettings.php. Allowed values are: webfonts (default) and javascript.

Example: $wgFaRenderMode = 'javascript';

For a discussion of the advantages and drawbacks of the render modes see Performance & Font Awesome on fontawesome.com.

UsageEdit

This extension defines three parser functions:

  • {{#far:...}} to insert an icon from the FontAwesome Regular font
  • {{#fas:...}} to insert an icon from the FontAwesome Solid font
  • {{#fab:...}} to insert an icon from the FontAwesome Brands font

Example: {{#fab:wikipedia-w}} will insert the Wikipedia-W

For valid icon names see https://fontawesome.com/icons.

LicenseEdit

GNU General Public License 3.0 or later

The Font Awesome Free package is included in the extension. See its license file for details.