silverstripe-font-awesome/readme.md

49 lines
1.2 KiB
Markdown
Raw Normal View History

2015-05-09 05:23:07 +02:00
## Pillaged
2015-05-09 05:23:36 +02:00
Shamefully pillaged from https://github.com/thisisbd/silverstripe-fontawesome-iconpickerfield and further modified/extended to better suit our environment and preferred coding style.
2015-05-09 02:31:32 +02:00
2015-05-09 05:23:07 +02:00
## Synopsis
2015-05-09 02:31:32 +02:00
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
2015-05-09 04:58:24 +02:00
* Option to use CDN for loading assets (Defaults to use local)
2015-05-10 02:11:01 +02:00
* Injects font-awesome.css into the frontend (Can disable in settings)
2015-05-09 02:31:32 +02:00
## 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;
```php
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
```html
<i class="fa $Icon"></i>
```
2015-05-09 05:23:07 +02:00
Alternatively you can just use the font family via CSS.