mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Updating getFormField to use upload field if config isset.
This commit is contained in:
parent
d53a66353b
commit
9922ab36ce
@ -49,9 +49,14 @@ class EditableFileField extends EditableFormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getFormField() {
|
public function getFormField() {
|
||||||
$field = FileField::create($this->Name, $this->EscapedTitle)
|
if(isset(Config::inst()->get('EditableFileField', 'use_uploadfield')) && Config::inst()->get('EditableFileField', 'use_uploadfield')) {
|
||||||
->setFieldHolderTemplate('UserFormsField_holder')
|
$field = Upload::create($this->Name, $this->EscapedTitle)
|
||||||
->setTemplate('UserFormsFileField');
|
} else {
|
||||||
|
$field = FileField::create($this->Name, $this->EscapedTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
$field->setFieldHolderTemplate('UserFormsField_holder')
|
||||||
|
->setTemplate('UserFormsFileField');
|
||||||
|
|
||||||
$field->getValidator()->setAllowedExtensions(
|
$field->getValidator()->setAllowedExtensions(
|
||||||
array_diff(
|
array_diff(
|
||||||
|
Loading…
Reference in New Issue
Block a user