Skip to content

Commit

Permalink
Merge pull request #176 from creative-commoners/pulls/1/inline-submit
Browse files Browse the repository at this point in the history
ENH Add MyFile to ElementContentExtension
  • Loading branch information
GuySartorelli authored May 8, 2024
2 parents d12463a + ebc198a commit 3b2b4c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/elemental/ElementContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\FrameworkTest\Elemental\Extension;

use SilverStripe\Assets\File;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\FieldList;
Expand All @@ -23,6 +24,7 @@ class ElementContentExtension extends Extension

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

public function validate(ValidationResult $result)
Expand All @@ -40,7 +42,7 @@ public function validate(ValidationResult $result)

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

public function updateCMSFields(FieldList $fields)
Expand Down

0 comments on commit 3b2b4c6

Please sign in to comment.