From 088ebffb50527a1cfcaf58ad2de84176f82a27b8 Mon Sep 17 00:00:00 2001 From: Chris Turner Date: Sun, 10 May 2015 12:11:01 +1200 Subject: [PATCH] Further options --- code/extensions/FAInjector.php | 4 ++++ code/extensions/FASettings.php | 14 ++++++++++++-- readme.md | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/code/extensions/FAInjector.php b/code/extensions/FAInjector.php index dd87847..7f399d3 100644 --- a/code/extensions/FAInjector.php +++ b/code/extensions/FAInjector.php @@ -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 { diff --git a/code/extensions/FASettings.php b/code/extensions/FASettings.php index 7988b84..350fb48 100644 --- a/code/extensions/FASettings.php +++ b/code/extensions/FASettings.php @@ -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( diff --git a/readme.md b/readme.md index af48a6d..319b71e 100644 --- a/readme.md +++ b/readme.md @@ -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