Updating getFormField to use upload field if config isset.

This commit is contained in:
jkRoberts 2016-04-08 11:47:53 +12:00
parent d53a66353b
commit 9922ab36ce

View File

@ -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(