2014-05-14 06:14:15 +02:00
|
|
|
<?php
|
|
|
|
|
2017-12-11 00:10:56 +01:00
|
|
|
namespace SilverStripe\VersionFeed;
|
|
|
|
|
|
|
|
use SilverStripe\Core\Config\Config;
|
|
|
|
use SilverStripe\Forms\CheckboxField;
|
|
|
|
use SilverStripe\Forms\FieldGroup;
|
2017-12-18 03:56:39 +01:00
|
|
|
use SilverStripe\Forms\FieldList;
|
2017-12-11 00:10:56 +01:00
|
|
|
use SilverStripe\ORM\DataExtension;
|
2024-01-18 22:58:29 +01:00
|
|
|
use SilverStripe\SiteConfig\SiteConfig;
|
2017-12-11 00:10:56 +01:00
|
|
|
|
2014-05-14 06:14:15 +02:00
|
|
|
/**
|
|
|
|
* Allows global configuration of all changes
|
2024-01-18 22:58:29 +01:00
|
|
|
*
|
|
|
|
* @extends DataExtension<SiteConfig>
|
2014-05-14 06:14:15 +02:00
|
|
|
*/
|
2017-12-11 21:47:35 +01:00
|
|
|
class VersionFeedSiteConfig extends DataExtension
|
|
|
|
{
|
|
|
|
private static $db = array(
|
|
|
|
'AllChangesEnabled' => 'Boolean(true)'
|
|
|
|
);
|
|
|
|
|
|
|
|
private static $defaults = array(
|
|
|
|
'AllChangesEnabled' => true
|
|
|
|
);
|
|
|
|
|
|
|
|
public function updateFieldLabels(&$labels)
|
|
|
|
{
|
2017-12-13 03:36:20 +01:00
|
|
|
$labels['AllChangesEnabled'] = _t(__CLASS__ . '.ALLCHANGESLABEL', 'Make global changes feed public');
|
2017-12-11 21:47:35 +01:00
|
|
|
}
|
2024-01-18 22:58:29 +01:00
|
|
|
|
2017-12-11 21:47:35 +01:00
|
|
|
public function updateCMSFields(FieldList $fields)
|
|
|
|
{
|
|
|
|
if (!Config::inst()->get(VersionFeed::class, 'allchanges_enabled')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$fields->addFieldToTab(
|
|
|
|
'Root.Access',
|
|
|
|
FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled')))
|
2017-12-13 03:36:20 +01:00
|
|
|
->setTitle(_t(__CLASS__ . '.ALLCHANGES', 'All page changes'))
|
2017-12-11 21:47:35 +01:00
|
|
|
->setDescription(_t(
|
2017-12-18 03:56:39 +01:00
|
|
|
'SilverStripe\\VersionFeed\\VersionFeed.Warning',
|
2017-12-11 21:47:35 +01:00
|
|
|
"Publicising the history will also disclose the changes that have at the time been protected " .
|
|
|
|
"from the public view."
|
|
|
|
))
|
|
|
|
);
|
|
|
|
}
|
2014-05-14 06:14:15 +02:00
|
|
|
}
|