Skip to content

Commit

Permalink
BUGFIX Allowing translations of VirtualPage by not copying over origi…
Browse files Browse the repository at this point in the history
…nal Locale property (see #5000) (from r97912)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102554 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Apr 13, 2010
1 parent 48bd1ff commit 6c0efa6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/model/VirtualPage.php
Expand Up @@ -30,7 +30,8 @@ function getVirtualFields() {
"Sort",
"Status",
'ShowInMenus',
'ShowInSearch'
'ShowInSearch',
'Locale'
);

$allFields = $this->db();
Expand Down
15 changes: 15 additions & 0 deletions tests/model/TranslatableTest.php
Expand Up @@ -681,6 +681,21 @@ function testSiteTreeChangePageTypeInMaster() {
);
}

function testLocalePersistsInAllPageTypes() {
$types = ClassInfo::subclassesFor('SiteTree');
foreach($types as $type) {
if(singleton($type) instanceof TestOnly) continue;

$enPage = new $type();
$enPage->Locale = 'en_US';
$enPage->write();

$dePage = $enPage->createTranslation('de_DE');
$dePage->write();
$this->assertEquals('de_DE', $dePage->Locale, "Page type $type retains Locale property");
}
}

function testGetTranslationByStage() {
$publishedPage = new SiteTree();
$publishedPage->Locale = 'en_US';
Expand Down

0 comments on commit 6c0efa6

Please sign in to comment.