From 9087f797230b1c4038fd1f1c16a8caf7e85d349e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 13 Oct 2010 01:05:08 +0000 Subject: [PATCH] BUGFIX Always including "Locale" field in Translatable->getCMSFields() regardless of "excluded" page types. Necessary to enable form state serialization for fields like TreeSelectorField on a VirtualPage (fixes #5269) (from r101747) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112031 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Translatable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/model/Translatable.php b/core/model/Translatable.php index f21031e21..f9c2a9e94 100755 --- a/core/model/Translatable.php +++ b/core/model/Translatable.php @@ -893,6 +893,9 @@ class Translatable extends DataObjectDecorator implements PermissionProvider { // Don't apply these modifications for normal DataObjects - they rely on CMSMain logic if(!($this->owner instanceof SiteTree)) return; + // used in CMSMain->init() to set language state when reading/writing record + $fields->push(new HiddenField("Locale", "Locale", $this->owner->Locale) ); + // Don't allow translation of virtual pages because of data inconsistencies (see #5000) $excludedPageTypes = array('VirtualPage'); foreach($excludedPageTypes as $excludedPageType) { @@ -905,9 +908,6 @@ class Translatable extends DataObjectDecorator implements PermissionProvider { 'CanViewType', 'CanEditType' ); - - // used in CMSMain->init() to set language state when reading/writing record - $fields->push(new HiddenField("Locale", "Locale", $this->owner->Locale) ); // if a language other than default language is used, we're in "translation mode", // hence have to modify the original fields