Skip to content

A simple form field for selecting font-awesome classes in the CMS with PREVIEW bootstrap 4 input-group.

Notifications You must be signed in to change notification settings

seppzzz/silverstripe-font-awesome

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

Provides a field to easily pick font-awesome icons

Features

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

Screen shots


Filter view

Filter

Usage

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

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

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

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

        return $fields;
    }

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

    <i class="fa $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 4.7

About

A simple form field for selecting font-awesome classes in the CMS with PREVIEW bootstrap 4 input-group.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 79.1%
  • JavaScript 7.9%
  • CSS 6.7%
  • Scheme 6.3%