A simple form field for selecting font-awesome classes in the CMS.
Go to file
2015-06-08 12:56:11 +12:00
_config Further cleanup 2015-05-10 13:29:12 +12:00
code Set defaults for settings. 2015-05-18 15:57:03 -04:00
css General housekeeping 2015-05-10 12:00:14 +12:00
fonts Initial commit. 2015-05-09 12:31:32 +12:00
js Reformatting; 2015-06-08 12:56:11 +12:00
_config.php Initial commit. 2015-05-09 14:58:24 +12:00
.gitignore Initial commit. 2015-05-09 12:31:32 +12:00
composer.json Update composer.json 2015-05-17 21:22:06 -04:00
readme.md Further options 2015-05-10 12:11:01 +12:00

Pillaged

Shamefully pillaged from https://github.com/thisisbd/silverstripe-fontawesome-iconpickerfield and further modified/extended to better suit our environment and preferred coding style.

Synopsis

A simple form field for selecting font-awesome classes in the CMS.

Features

  • The latest version of font-awesome
  • Easy to integrate into any project
  • Option to use CDN for loading assets (Defaults to use local)
  • Injects font-awesome.css into the frontend (Can disable in settings)

Installation

Composer

Make sure you're not double loading the css/fonts with a theme.

Ideally composer will be used to install this module. composer require "moe/font-awesome:@stable"

Usage

A basic working example, and the following to any class you want the field on;


private static $db = array(
   'Icon'  => 'Varchar',
);

public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->addFieldsToTab('Root.ButtonDetails', array(
            FontAwesomeField::create("Icon", "Font Awesome icon"),
        ));

        return $fields;
    }

Then simple include in the template

 <i class="fa $Icon"></i>

Alternatively you can just use the font family via CSS.