Further options

This commit is contained in:
Chris Turner 2015-05-10 12:11:01 +12:00
parent 18f99e0b55
commit 088ebffb50
3 changed files with 17 additions and 3 deletions

View File

@ -7,6 +7,10 @@ class FAInjector extends Extension
{
public function onBeforeInit()
{
if (SiteConfig::current_site_config()->UseThemeCSS) {
return;
}
if (SiteConfig::current_site_config()->UseCDN) {
Requirements::css("//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css");
} else {

View File

@ -6,16 +6,26 @@
class FASettings extends DataExtension
{
private static $db = array(
'UseCDN' => 'boolean(1)'
'UseCDN' => 'boolean(1)',
'UseThemeCSS' => 'boolean(1)',
);
private static $defaults = array(
'UseCDN' => 'No'
'UseCDN' => 'No',
'UseThemeCSS' => 'No',
);
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldsToTab('Root.FontAwesome', array(
OptionsetField::create('UseThemeCSS', 'Theme dir font-awesome.css?')
->setDescription('You may want to use font-awesome.css from your theme directory')
->setSource(array(
true => 'Yes',
false => 'No'
)),
OptionsetField::create('UseCDN', 'CDN for loading frontend assets?')
->setDescription('Depending on hosting, your viewers may or may not get better performance using a CDN')
->setSource(array(

View File

@ -8,7 +8,7 @@ A simple form field for selecting font-awesome classes in the CMS.
* The latest version of font-awesome
* Easy to integrate into any project
* Option to use CDN for loading assets (Defaults to use local)
* Injects font-awesome.css into the frontend - so remove it from your project build
* Injects font-awesome.css into the frontend (Can disable in settings)
## Installation