From 58355971071637ed896a411cd5c765c1566d4593 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 25 May 2020 10:11:03 +1200 Subject: [PATCH] NEW DB column showing if file is userform upload - UserFormUpload used by File::isTrackedFormUpload() --- _config/extensions.yml | 3 +++ code/Control/UserDefinedFormController.php | 2 ++ composer.json | 1 + 3 files changed, 6 insertions(+) diff --git a/_config/extensions.yml b/_config/extensions.yml index 3e243dccb..5ec2910c4 100644 --- a/_config/extensions.yml +++ b/_config/extensions.yml @@ -4,3 +4,6 @@ Name: userformsextensions SilverStripe\UserForms\Model\UserDefinedForm: extensions: UpgradePolymorphicExtension: SilverStripe\UserForms\Extension\UpgradePolymorphicExtension +SilverStripe\Assets\File: + extensions: + - SilverStripe\UserForms\Extension\UserFormFileExtension diff --git a/code/Control/UserDefinedFormController.php b/code/Control/UserDefinedFormController.php index 4f2e8049f..3ed0b753f 100644 --- a/code/Control/UserDefinedFormController.php +++ b/code/Control/UserDefinedFormController.php @@ -20,6 +20,7 @@ use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationResult; use SilverStripe\Security\Security; +use SilverStripe\UserForms\Extension\UserFormFileExtension; use SilverStripe\UserForms\Form\UserForm; use SilverStripe\UserForms\Model\EditableFormField; use SilverStripe\UserForms\Model\EditableFormField\EditableFileField; @@ -257,6 +258,7 @@ public function process($data, $form) $upload = Upload::create(); $file = File::create(); $file->ShowInSearch = 0; + $file->UserFormUpload = UserFormFileExtension::USER_FORM_UPLOAD_TRUE; try { $upload->loadIntoFile($_FILES[$field->Name], $file, $foldername); } catch (ValidationException $e) { diff --git a/composer.json b/composer.json index b4344a974..5cee7392b 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ } ], "require": { + "php": ">=7.1", "silverstripe/cms": "^4.0", "symbiote/silverstripe-gridfieldextensions": "^3.1", "silverstripe/segment-field": "^2.0",