2017 © Pedro Peláez
 

silverstripe-vendormodule font-icons

SilverWare Font Icons Module.

image

silverware/font-icons

SilverWare Font Icons Module.

  • Tuesday, June 12, 2018
  • by PraxisNetAu
  • Repository
  • 1 Watchers
  • 2 Stars
  • 397 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 15 Versions
  • 35 % Grown

The README.md

SilverWare Font Icons Module

Latest Stable Version Latest Unstable Version License, (*1)

Provides a new form field and database field type for referencing a font icon. Intended to be used with SilverWare, however this module can also be installed into a regular SilverStripe v4 project. A backend for Font Awesome is provided with the module., (*2)

Contents

Background

Font icons are neat. They look great on all devices, and are really easy to reference via HTML and CSS. However, font icon libraries such as Font Awesome provide a staggering amount of icons, and we can't really expect users to remember the icon names, codes, or have to refer to a cheatsheet., (*3)

We could just provide a standard select field listing all of the icons on offer, but users need to know what the icons look like. Enter FontIconField provided by this module. An extension of the SilverWare Select2AjaxField class, it provides an Ajax-powered searchable list of icons provided by the configured backend, along with a preview of each icon., (*4)

Requirements

Installation

Installation is via Composer:, (*5)

$ composer require silverware/font-icons

Configuration

As with all SilverStripe modules, configuration is via YAML. The SilverStripe dependency injector is used to configure the font icon backend. Font Awesome is configured by default:, (*6)

SilverStripe\Core\Injector\Injector:
  FontIconBackend:
    class: SilverWare\FontIcons\Backends\FontAwesomeBackend
    properties:
      version: 4.7.0
      classes:
        icon: fa-%s
        list-item: fa-li
        fixed-width: fa-fw

You can specify the version of Font Awesome in use by changing the version property. Upon flush, the backend will download a full list of icons from GitHub and cache the results until the next flush., (*7)

Usage

Field Type

To make use of font icons in your code, you can reference the field type in your $db array:, (*8)

use SilverStripe\ORM\DataObject;

class MyObject extends DataObject
{
    private static $db = [
        'Icon' => 'FontIcon'
    ];
}

You can also use the field type within your class file, and reference the field type directly:, (*9)

use SilverStripe\ORM\DataObject;
use SilverWare\FontIcons\ORM\FieldType\DBFontIcon;

class MyObject extends DataObject
{
    private static $db = [
        'Icon' => DBFontIcon::class
    ];
}

Form Field

Within your getCMSFields method, create a FontIconField to allow the user to select an icon:, (*10)

FontIconField::create('Icon', $this->fieldLabel('Icon'));

Don't forget to first use the field in the header of your class file:, (*11)

use SilverWare\FontIcons\Forms\FontIconField;

Data Extension

The module also comes with a data extension class to easily add font icons to data objects within SilverStripe. The extension adds a FontIcon database field, and a new Icon tab within the CMS containing a FontIconField., (*12)

To apply the extension to your class, use YAML configuration:, (*13)

MyNamespace\MyObject:
  extensions:
    - SilverWare\FontIcons\Extensions\FontIconExtension

Issues

Please use the GitHub issue tracker for bug reports and feature requests., (*14)

To-Do

  • Tests

Contribution

Your contributions are gladly welcomed to help make this project better. Please see contributing for more information., (*15)

Attribution

Maintainers

Colin Tucker Praxis Interactive
Colin Tucker Praxis Interactive

License

BSD-3-Clause © Praxis Interactive, (*16)

The Versions

12/06 2018

dev-master

9999999-dev https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

12/06 2018

1.2.0

1.2.0.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

03/11 2017

1.1.6

1.1.6.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

08/10 2017

1.1.5

1.1.5.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

08/10 2017

1.1.4

1.1.4.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

07/10 2017

1.1.3

1.1.3.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

07/10 2017

1.1.2

1.1.2.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

12/09 2017

1.1.1

1.1.1.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

05/09 2017

1.1.0

1.1.0.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

15/06 2017

1.0.0

1.0.0.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

08/06 2017

0.1.4

0.1.4.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

07/06 2017

0.1.3

0.1.3.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

15/05 2017

0.1.2

0.1.2.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

30/04 2017

0.1.1

0.1.1.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware

30/04 2017

0.1.0

0.1.0.0 https://github.com/praxisnetau/silverware-font-icons

SilverWare Font Icons Module.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe font icons silverware