From 99cf50139303a46fa5780045b6c13aca7b7a7c0b Mon Sep 17 00:00:00 2001 From: Aram Balakjian Date: Mon, 23 Mar 2015 16:59:05 +0000 Subject: [PATCH] NEW Only add comments to SiteTree objects if needed --- _config.php | 4 ++-- code/Commenting.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/_config.php b/_config.php index 85a71c9..1071adc 100644 --- a/_config.php +++ b/_config.php @@ -26,6 +26,6 @@ * consult the Commenting class. */ -if(class_exists('SiteTree') && !Commenting::has_commenting('SiteTree')) { +if(Config::inst()->get('Commenting', 'sitetree_comments') && class_exists('SiteTree') && !Commenting::has_commenting('SiteTree')) { Commenting::add('SiteTree'); -} \ No newline at end of file +} diff --git a/code/Commenting.php b/code/Commenting.php index 2ea6827..affeb04 100644 --- a/code/Commenting.php +++ b/code/Commenting.php @@ -13,12 +13,18 @@ */ class Commenting { - + /** * @var array map of enabled {@link DataObject} and related configuration */ private static $enabled_classes = array(); - + + /** + * @config + * @var bool Whether to enable commenting on SiteTree objects by default + */ + private static $sitetree_comments = true; + /** * @var array default configuration values */