From 671c7daa4c13532bfb8f6ab5c6ff7446548b515a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 6 Aug 2012 09:36:25 +0200 Subject: [PATCH] SiteConfig load/save with ID in CMS Allow loading a SiteConfig by ID (by specifying $tree_class), and pass the ID through with the form data. Unifies processing with SiteTree, and allows the Translatable module to use the same logic for interacting with the load/save process. --- code/controllers/CMSSettingsController.php | 1 + code/model/SiteConfig.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/controllers/CMSSettingsController.php b/code/controllers/CMSSettingsController.php index 98afcd61..e0815272 100644 --- a/code/controllers/CMSSettingsController.php +++ b/code/controllers/CMSSettingsController.php @@ -5,6 +5,7 @@ class CMSSettingsController extends LeftAndMain { static $url_rule = '/$Action/$ID/$OtherID'; static $menu_priority = -1; static $menu_title = 'Settings'; + static $tree_class = 'SiteConfig'; public function getResponseNegotiator() { $neg = parent::getResponseNegotiator(); diff --git a/code/model/SiteConfig.php b/code/model/SiteConfig.php index 56887e05..66da02cf 100644 --- a/code/model/SiteConfig.php +++ b/code/model/SiteConfig.php @@ -65,7 +65,8 @@ class SiteConfig extends DataObject implements PermissionProvider { $topLevelCreatorsGroupsField = ListboxField::create("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators")) ->setMultiple(true)->setSource($groupsMap) ) - ) + ), + new HiddenField('ID') ); $themeDropdownField->setEmptyString(_t('SiteConfig.DEFAULTTHEME', '(Use default theme)'));