A simple form field for selecting font-awesome classes in the CMS.
Go to file
2024-07-27 11:38:37 +02:00
code/formfields Minor styling fixtures 2024-07-27 11:38:37 +02:00
dist Minor styling fixtures 2024-07-27 11:38:37 +02:00
src Minor styling fixtures 2024-07-27 11:38:37 +02:00
_config.php silverstripe 4 compatibility 2017-06-09 09:14:28 +02:00
.editorconfig Added standard .editorconfig file 2015-12-18 08:40:56 +13:00
.gitattributes Added standard .gitattributes file 2016-01-16 16:49:31 +13:00
.gitignore UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
.scrutinizer.yml Added standard Scrutinizer config 2016-02-17 02:12:11 +13:00
babel.config.json UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
composer.json UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
eslint.config.json UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
package.json UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
pnpm-lock.yaml UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
readme.md Update readme.md 2018-06-24 17:01:13 +07:00
sass-lint.yml UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
webpack.config.common.js UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
webpack.config.js UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
webpack.config.serve.js UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00
webpack.yml UPGRADE fontawesome field 2024-07-27 11:22:49 +02:00

Synopsis

Provides a field to easily pick font-awesome icons

Features

  • Easily pick icons to be used anywhere in the backend
  • Can filter on icon name

Requirements

SilverStripe 4+

Installation

Composer

Ideally composer will be used to install this module. composer require "a2nt/silverstripe-font-awesome:@dev-master"

Screen shots

Font awesome icon view

Font awesome icon

Filter view

Filter

Usage

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

use SilverStripe\FontAwesome\FontAwesomeField;

class Blabla extends ... {
    private static $db = array(
        'Icon' => 'Varchar(255)',
    );

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

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

        return $fields;
    }
}

Then simple include in the template where you want the icon placed

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

The controller extension should make sure you've got access to the icons so you don't need to double up the CSS file.

Want colours instead of icons?

Got you covered, checkout color-swabs!

Libraries used/modified

  • Font Awesome > 5