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)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101747 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-03-27 01:27:30 +00:00 committed by Sam Minnee
parent d41539ad22
commit 0e4a042ece

View File

@ -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