Skip to content

Commit

Permalink
Merge branch '1' into 2
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 11, 2024
2 parents 0c5f70f + 3b2b4c6 commit 2488992
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/TestRegistryPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use SilverStripe\Security\DefaultAdminService;
use SilverStripe\Security\Member;

if (!class_exists(RegistryPage::class)) {
if (class_exists(RegistryPage::class)) {
class TestRegistryPage extends RegistryPage
{
public function requireDefaultRecords()
Expand Down
9 changes: 8 additions & 1 deletion code/elemental/ElementContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace SilverStripe\FrameworkTest\Elemental\Extension;

use SilverStripe\Assets\File;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\ValidationResult;
Expand All @@ -20,6 +22,11 @@ class ElementContentExtension extends Extension
'MyInt' => 'Int',
];

private static $has_one = [
'MyPage' => SiteTree::class,
'MyFile' => File::class,
];

public function validate(ValidationResult $result)
{
if ($this->owner->Title == 'x') {
Expand All @@ -35,7 +42,7 @@ public function validate(ValidationResult $result)

public function updateCMSCompositeValidator(CompositeValidator $compositeValidator)
{
$compositeValidator->addValidator(new RequiredFields(['Title']));
$compositeValidator->addValidator(new RequiredFields(['Title', 'MyPageID', 'MyFile']));
}

public function updateCMSFields(FieldList $fields)
Expand Down

0 comments on commit 2488992

Please sign in to comment.