mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX: Remove version field from default scaffolded CMS fields.
This commit is contained in:
parent
1bc945f98c
commit
f6cd582dd9
@ -1313,6 +1313,15 @@ class Versioned extends DataExtension {
|
||||
$labels['Versions'] = _t('Versioned.has_many_Versions', 'Versions', 'Past Versions of this page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FieldList
|
||||
*/
|
||||
public function updateCMSFields(&$fields) {
|
||||
// remove the version field from the CMS as this should be left
|
||||
// entirely up to the extension (not the cms user).
|
||||
$fields->removeByName('Version');
|
||||
}
|
||||
|
||||
public function flushCache() {
|
||||
self::$cache_versionnumber = array();
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
*/
|
||||
class VersionedTest extends SapphireTest {
|
||||
|
||||
protected static $fixture_file = 'VersionedTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
@ -124,6 +129,13 @@ class VersionedTest extends SapphireTest {
|
||||
$this->assertInstanceOf('Int', $obj2->dbObject('Version'));
|
||||
}
|
||||
|
||||
public function testVersionedFieldsNotInCMS() {
|
||||
$obj = new VersionedTest_DataObject();
|
||||
|
||||
// the version field in cms causes issues with Versioned::augmentWrite()
|
||||
$this->assertNull($obj->getCMSFields()->dataFieldByName('Version'));
|
||||
}
|
||||
|
||||
public function testPublishCreateNewVersion() {
|
||||
$page1 = $this->objFromFixture('VersionedTest_DataObject', 'page1');
|
||||
$page1->Content = 'orig';
|
||||
@ -442,6 +454,11 @@ class VersionedTest extends SapphireTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
*/
|
||||
class VersionedTest_DataObject extends DataObject implements TestOnly {
|
||||
private static $db = array(
|
||||
"Name" => "Varchar",
|
||||
@ -463,6 +480,10 @@ class VersionedTest_DataObject extends DataObject implements TestOnly {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
*/
|
||||
class VersionedTest_RelatedWithoutVersion extends DataObject implements TestOnly {
|
||||
|
||||
private static $db = array(
|
||||
@ -475,6 +496,10 @@ class VersionedTest_RelatedWithoutVersion extends DataObject implements TestOnly
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
*/
|
||||
class VersionedTest_Subclass extends VersionedTest_DataObject implements TestOnly {
|
||||
private static $db = array(
|
||||
"ExtraField" => "Varchar",
|
||||
@ -486,7 +511,8 @@ class VersionedTest_Subclass extends VersionedTest_DataObject implements TestOnl
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
* @package framework
|
||||
* @subpackage tests
|
||||
*/
|
||||
class VersionedTest_UnversionedWithField extends DataObject implements TestOnly {
|
||||
private static $db = array('Version' => 'Varchar(255)');
|
||||
|
Loading…
x
Reference in New Issue
Block a user