- Always up to date: We read the yaml from the font awesome repository. Just specify your version and you're read to go.
- Optional on the frontend: We know on the frontend you might like to bundle your own font awesome icons, so you choose if you want us to load them from the CDN.
FontAwesomeIconField:
version: 4.6.3
autoload_css: true
class PageWithIcon extends Page {
protected static $db = [
'PageIcon' => 'FontAwesomeIcon',
];
public function getCMSFields(){
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', FontAwesomeIconField::create('PageIcon', 'Icon'));
return $fields;
}
}
<div>
<strong>Page Icon:</strong> <i class="{$PageIcon.Classes} some-other-class"></i>
</div>
<div>
<strong>Page Icon:</strong> {$PageIcon}
</div>