mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge branch '5.6' into 5.7
This commit is contained in:
commit
ead1827aa1
6
_config/mimevalidator.yml
Normal file
6
_config/mimevalidator.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
Name: mimeuploadvalidator-userforms
|
||||||
|
---
|
||||||
|
SilverStripe\Core\Injector\Injector:
|
||||||
|
SilverStripe\Assets\Upload_Validator.userforms:
|
||||||
|
class: SilverStripe\MimeValidator\MimeUploadValidator
|
@ -4,9 +4,11 @@ namespace SilverStripe\UserForms\Model\EditableFormField;
|
|||||||
|
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Assets\Folder;
|
use SilverStripe\Assets\Folder;
|
||||||
|
use SilverStripe\Assets\Upload_Validator;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Forms\FileField;
|
use SilverStripe\Forms\FileField;
|
||||||
use SilverStripe\Forms\LiteralField;
|
use SilverStripe\Forms\LiteralField;
|
||||||
use SilverStripe\Forms\NumericField;
|
use SilverStripe\Forms\NumericField;
|
||||||
@ -192,11 +194,14 @@ class EditableFileField extends EditableFormField
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getFormField()
|
public function getFormField()
|
||||||
{
|
{
|
||||||
$field = FileField::create($this->Name, $this->Title ?: false)
|
$field = FileField::create($this->Name, $this->Title ?: false)
|
||||||
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||||
->setTemplate(__CLASS__);
|
->setTemplate(__CLASS__)
|
||||||
|
->setValidator(Injector::inst()->get(Upload_Validator::class . '.userforms'));
|
||||||
|
|
||||||
$field->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
$field->setFieldHolderTemplate(EditableFormField::class . '_holder')
|
||||||
->setTemplate(__CLASS__);
|
->setTemplate(__CLASS__);
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
"silverstripe/cms": "^4.6",
|
"silverstripe/cms": "^4.6",
|
||||||
"symbiote/silverstripe-gridfieldextensions": "^3.1",
|
"symbiote/silverstripe-gridfieldextensions": "^3.1",
|
||||||
"silverstripe/segment-field": "^2.0",
|
"silverstripe/segment-field": "^2.0",
|
||||||
"silverstripe/versioned": "^1.0"
|
"silverstripe/versioned": "^1.0",
|
||||||
|
"silverstripe/mimevalidator": "^2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^5.7",
|
"phpunit/phpunit": "^5.7",
|
||||||
|
Loading…
Reference in New Issue
Block a user