mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Merge branch '1' into 2
This commit is contained in:
commit
248899294a
@ -6,7 +6,7 @@ use SilverStripe\Registry\RegistryPage;
|
|||||||
use SilverStripe\Security\DefaultAdminService;
|
use SilverStripe\Security\DefaultAdminService;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
|
|
||||||
if (!class_exists(RegistryPage::class)) {
|
if (class_exists(RegistryPage::class)) {
|
||||||
class TestRegistryPage extends RegistryPage
|
class TestRegistryPage extends RegistryPage
|
||||||
{
|
{
|
||||||
public function requireDefaultRecords()
|
public function requireDefaultRecords()
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace SilverStripe\FrameworkTest\Elemental\Extension;
|
namespace SilverStripe\FrameworkTest\Elemental\Extension;
|
||||||
|
|
||||||
|
use SilverStripe\Assets\File;
|
||||||
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Core\Extension;
|
use SilverStripe\Core\Extension;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\ValidationResult;
|
use SilverStripe\ORM\ValidationResult;
|
||||||
@ -20,6 +22,11 @@ class ElementContentExtension extends Extension
|
|||||||
'MyInt' => 'Int',
|
'MyInt' => 'Int',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private static $has_one = [
|
||||||
|
'MyPage' => SiteTree::class,
|
||||||
|
'MyFile' => File::class,
|
||||||
|
];
|
||||||
|
|
||||||
public function validate(ValidationResult $result)
|
public function validate(ValidationResult $result)
|
||||||
{
|
{
|
||||||
if ($this->owner->Title == 'x') {
|
if ($this->owner->Title == 'x') {
|
||||||
@ -35,7 +42,7 @@ class ElementContentExtension extends Extension
|
|||||||
|
|
||||||
public function updateCMSCompositeValidator(CompositeValidator $compositeValidator)
|
public function updateCMSCompositeValidator(CompositeValidator $compositeValidator)
|
||||||
{
|
{
|
||||||
$compositeValidator->addValidator(new RequiredFields(['Title']));
|
$compositeValidator->addValidator(new RequiredFields(['Title', 'MyPageID', 'MyFile']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateCMSFields(FieldList $fields)
|
public function updateCMSFields(FieldList $fields)
|
||||||
|
Loading…
Reference in New Issue
Block a user