protected function get_draft_files($elname) {
        global $USER;

        if (!$this->is_submitted()) {
            return false;
        }

        $element = $this->_form->getElement($elname);

        if ($element instanceof MoodleQuickForm_filepicker || $element instanceof MoodleQuickForm_filemanager) {
            $values = $this->_form->exportValues($elname);
            if (empty($values[$elname])) {
                return false;
            }
            $draftid = $values[$elname];
            $fs = get_file_storage();
            $context = context_user::instance($USER->id);
            if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
                return null;
            }
            return $files;
        }
        return null;
    }
protected function get_draft_files($elname) {
        global $USER;

        if (!$this->is_submitted()) {
            return false;
        }

        $element = $this->_form->getElement($elname);

        if ($element instanceof MoodleQuickForm_filepicker || $element instanceof MoodleQuickForm_filemanager) {
            $values = $this->_form->exportValues($elname);
            if (empty($values[$elname])) {
                return false;
            }
            $draftid = $values[$elname];
            $fs = get_file_storage();
            $context = context_user::instance($USER->id);
            if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
                return null;
            }
            return $files;
        }
        return null;
    }
protected function get_draft_files ( $ elname ) { global $ USER ; if ( ! $ this -> is_submitted ( ) ) { return false ; } $ element = $ this -> _form -> getElement ( $ elname ) ; if ( $ element instanceof MoodleQuickForm_filepicker || $ element instanceof MoodleQuickForm_filemanager ) { $ values = $ this -> _form -> exportValues ( $ elname ) ; if ( empty ( $ values [ $ elname ] ) ) { return false ; } $ draftid = $ values [ $ elname ] ; $ fs = get_file_storage ( ) ; $ context = context_user :: instance ( $ USER -> id ) ; if ( ! $ files = $ fs -> get_area_files ( $ context -> id , 'user' , 'draft' , $ draftid , 'id DESC' , false ) ) { return null ; } return $ files ; } return null ; }
Get draft files of a form element
This is a protected method which will be used only inside moodleforms

@param string $elname name of element
@return array|bool|null
Get draft files of a form element This is a protected method which will be used only inside moodleforms