Version: current

     1 <?php
     2
     3 /**
     4  * Allows a user to add a field that can be used to upload a file.
     5  *
     6  * @package userforms
     7  */
     8
     9 class EditableFileField extends EditableFormField {
    10
    11     static $singular_name = 'File Upload Field';
    12     static $plural_names = 'File Fields';
    13
    14     public function getFieldConfiguration() {
    15         $options = parent::getFieldConfiguration();
    16         $options->removeByName("Fields[$this->ID][CustomSettings][Placeholder]");
    17         return $options;
    18     }
    19
    20     public function getFormField() {
    21         $field = new FileField($this->Name, $this->Title);
    22
    23         return $field;
    24     }
    25
    26
    27     public function getSubmittedFormField() {
    28         return new SubmittedFileField();
    29     }
    30
    31     public function getValueFromData($data) {
    32         return '';
    33     }
    34 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -