Merge pull request #176 from creative-commoners/pulls/1/inline-submit

ENH Add MyFile to ElementContentExtension
This commit is contained in:
Guy Sartorelli 2024-05-09 09:14:22 +12:00 committed by GitHub
commit 3b2b4c6958
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
@ -23,6 +24,7 @@ class ElementContentExtension extends Extension
private static $has_one = [
'MyPage' => SiteTree::class,
'MyFile' => File::class,
];
public function validate(ValidationResult $result)
@ -40,7 +42,7 @@ class ElementContentExtension extends Extension
public function updateCMSCompositeValidator(CompositeValidator $compositeValidator)
{
$compositeValidator->addValidator(new RequiredFields(['Title', 'MyPageID']));
$compositeValidator->addValidator(new RequiredFields(['Title', 'MyPageID', 'MyFile']));
}
public function updateCMSFields(FieldList $fields)