From 13aefa8f48be61de9de49aa65405a6d5126d4a01 Mon Sep 17 00:00:00 2001 From: Christopher Pitt Date: Tue, 1 Dec 2015 10:14:59 +1300 Subject: [PATCH] Added default theme kill switch --- code/controllers/DocumentationViewer.php | 36 +++++++++++++++--------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/code/controllers/DocumentationViewer.php b/code/controllers/DocumentationViewer.php index 89a9ed3..38161a9 100755 --- a/code/controllers/DocumentationViewer.php +++ b/code/controllers/DocumentationViewer.php @@ -79,6 +79,13 @@ class DocumentationViewer extends Controller */ private static $edit_links = array(); + /** + * Determines whether css and js files are injected into the document. + * + * @var bool + */ + private static $apply_default_theme = true; + /** * */ @@ -89,21 +96,24 @@ class DocumentationViewer extends Controller if (!$this->canView()) { return Security::permissionFailure($this); } - Requirements::javascript('//use.typekit.net/emt4dhq.js'); - Requirements::customScript('try{Typekit.load();}catch(e){}'); - Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js'); - Requirements::javascript('https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js'); + if ($this->config()->apply_default_theme) { + Requirements::javascript('//use.typekit.net/emt4dhq.js'); + Requirements::customScript('try{Typekit.load();}catch(e){}'); - Requirements::javascript(DOCSVIEWER_DIR .'/javascript/DocumentationViewer.js'); - Requirements::combine_files('docs.css', array( - DOCSVIEWER_DIR .'/css/normalize.css', - DOCSVIEWER_DIR .'/css/utilities.css', - DOCSVIEWER_DIR .'/css/typography.css', - DOCSVIEWER_DIR .'/css/forms.css', - DOCSVIEWER_DIR .'/css/layout.css', - DOCSVIEWER_DIR .'/css/small.css' - )); + Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js'); + Requirements::javascript('https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js'); + + Requirements::javascript(DOCSVIEWER_DIR .'/javascript/DocumentationViewer.js'); + Requirements::combine_files('docs.css', array( + DOCSVIEWER_DIR .'/css/normalize.css', + DOCSVIEWER_DIR .'/css/utilities.css', + DOCSVIEWER_DIR .'/css/typography.css', + DOCSVIEWER_DIR .'/css/forms.css', + DOCSVIEWER_DIR .'/css/layout.css', + DOCSVIEWER_DIR .'/css/small.css' + )); + } } /**