From 9922ab36cea425c25cae3f0d869ff1bf61059c93 Mon Sep 17 00:00:00 2001 From: jkRoberts Date: Fri, 8 Apr 2016 11:47:53 +1200 Subject: [PATCH] Updating getFormField to use upload field if config isset. --- code/model/editableformfields/EditableFileField.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/model/editableformfields/EditableFileField.php b/code/model/editableformfields/EditableFileField.php index 84695ad..5b23cb2 100755 --- a/code/model/editableformfields/EditableFileField.php +++ b/code/model/editableformfields/EditableFileField.php @@ -49,9 +49,14 @@ class EditableFileField extends EditableFormField { } public function getFormField() { - $field = FileField::create($this->Name, $this->EscapedTitle) - ->setFieldHolderTemplate('UserFormsField_holder') - ->setTemplate('UserFormsFileField'); + if(isset(Config::inst()->get('EditableFileField', 'use_uploadfield')) && Config::inst()->get('EditableFileField', 'use_uploadfield')) { + $field = Upload::create($this->Name, $this->EscapedTitle) + } else { + $field = FileField::create($this->Name, $this->EscapedTitle) + } + + $field->setFieldHolderTemplate('UserFormsField_holder') + ->setTemplate('UserFormsFileField'); $field->getValidator()->setAllowedExtensions( array_diff(