Add ownership model for files

This commit is contained in:
Ingo Schommer 2017-07-06 14:20:29 +12:00
parent c272a25cb2
commit d2711a82bb

View File

@ -94,6 +94,12 @@ class BasicFieldsTestPage extends TestPage
'Listbox' => 'SilverStripe\\FrameworkTest\\Model\\TestCategory', 'Listbox' => 'SilverStripe\\FrameworkTest\\Model\\TestCategory',
); );
private static $owns = [
'AttachedFile',
'File',
'Image',
];
private static $defaults = array( private static $defaults = array(
'Validated' => 2 'Validated' => 2
); );
@ -270,11 +276,11 @@ class BasicFieldsTestPage extends TestPage
)); ));
$fields->addFieldsToTab('Root.File', array( $fields->addFieldsToTab('Root.File', array(
$bla = UploadField::create('File', 'UploadField with multiUpload=false') $bla = UploadField::create('File', 'UploadField with multiUpload=false (owned by page)')
->setDescription($description) ->setDescription($description)
->setRightTitle($rightTitle) ->setRightTitle($rightTitle)
->setIsMultiUpload(false), ->setIsMultiUpload(false),
UploadField::create('Image', 'UploadField for image') UploadField::create('Image', 'UploadField for image (owned by page)')
->setDescription($description) ->setDescription($description)
->setRightTitle($rightTitle), ->setRightTitle($rightTitle),
UploadField::create('HasManyFiles', 'UploadField for has_many') UploadField::create('HasManyFiles', 'UploadField for has_many')