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
This commit is contained in:
Sam Minnee 2010-10-13 01:05:08 +00:00
parent fd8e0044c4
commit 9087f79723

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 // Don't apply these modifications for normal DataObjects - they rely on CMSMain logic
if(!($this->owner instanceof SiteTree)) return; 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) // Don't allow translation of virtual pages because of data inconsistencies (see #5000)
$excludedPageTypes = array('VirtualPage'); $excludedPageTypes = array('VirtualPage');
foreach($excludedPageTypes as $excludedPageType) { foreach($excludedPageTypes as $excludedPageType) {
@ -905,9 +908,6 @@ class Translatable extends DataObjectDecorator implements PermissionProvider {
'CanViewType', 'CanViewType',
'CanEditType' '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", // if a language other than default language is used, we're in "translation mode",
// hence have to modify the original fields // hence have to modify the original fields