2015-05-09 05:23:07 +02:00
|
|
|
## Synopsis
|
2015-07-28 00:50:19 +02:00
|
|
|
Provides a field to easily pick font-awesome icons
|
2015-05-09 02:31:32 +02:00
|
|
|
|
|
|
|
## Features
|
2015-07-28 00:50:19 +02:00
|
|
|
* Easily pick icons to be used anywhere in the frontend
|
|
|
|
* Can filter on icon name
|
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"```
|
|
|
|
|
2015-07-28 00:50:19 +02:00
|
|
|
## Screen shots
|
|
|
|
|
|
|
|
### Font awesome icon view
|
2015-07-28 00:59:22 +02:00
|
|
|
![Font awesome icon](https://raw.githubusercontent.com/peavers/silverstripe-font-awesome/master/images/screens/font-awesome-icons.png "Icons")
|
2015-07-28 00:50:19 +02:00
|
|
|
---------------------------------------
|
|
|
|
### Filter view
|
2015-07-28 00:59:22 +02:00
|
|
|
![Filter](https://raw.githubusercontent.com/peavers/silverstripe-font-awesome/master/images/screens/font-awesome-filter.png "Filter")
|
2015-07-28 00:50:19 +02:00
|
|
|
|
2015-07-28 00:57:31 +02:00
|
|
|
|
2015-05-09 02:31:32 +02:00
|
|
|
## Usage
|
|
|
|
A basic working example, and the following to any class you want the field on;
|
|
|
|
|
|
|
|
```php
|
2015-07-28 00:50:19 +02:00
|
|
|
private static $db = array(
|
|
|
|
'Icon' => 'Varchar(255)',
|
|
|
|
);
|
2015-05-09 02:31:32 +02:00
|
|
|
|
2015-07-28 00:50:19 +02:00
|
|
|
public function getCMSFields()
|
2015-05-09 02:31:32 +02:00
|
|
|
{
|
|
|
|
$fields = parent::getCMSFields();
|
|
|
|
|
2015-07-28 00:50:19 +02:00
|
|
|
$fields->addFieldsToTab('Root.Main', array(
|
|
|
|
FontAwesomeField::create("Icon", "Font Awesome icon")
|
2015-05-09 02:31:32 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-07-28 00:50:19 +02:00
|
|
|
Then simple include in the template where you want the icon placed
|
2015-05-09 02:31:32 +02:00
|
|
|
```html
|
2015-07-28 00:50:19 +02:00
|
|
|
<i class="fa $Icon"></i>
|
2015-05-09 02:31:32 +02:00
|
|
|
```
|
|
|
|
|
2015-07-28 00:50:19 +02:00
|
|
|
The controller extension should make sure you've got access to the icons so you don't need to double up the CSS file.
|
2015-05-09 05:23:07 +02:00
|
|
|
|
2015-07-28 00:50:19 +02:00
|
|
|
## Libraries used/modified
|
|
|
|
* Font Awesome Icon Picker
|