Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-28099 fixes issue with filepicker and element names with index no…

…t passing

value for draftitemid.
  • Loading branch information...
commit b1eca34453a2a55b230a8befeabb31aba85e15cb 1 parent 3552484
James Pratt jamiepratt authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/form/filepicker.php
13 lib/form/filepicker.php
View
@@ -112,9 +112,13 @@ function toHtml() {
function exportValue(&$submitValues, $assoc = false) {
global $USER;
+ $draftitemid = $this->_findValue($submitValues);
+ if (null === $draftitemid) {
+ $draftitemid = $this->getValue();
+ }
+
// make sure max one file is present and it is not too big
- if (!empty($submitValues[$this->_attributes['name']])) {
- $draftitemid = $submitValues[$this->_attributes['name']];
+ if (!is_null($draftitemid)) {
$fs = get_file_storage();
$usercontext = get_context_instance(CONTEXT_USER, $USER->id);
if ($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id DESC', false)) {
@@ -128,10 +132,7 @@ function exportValue(&$submitValues, $assoc = false) {
$file->delete();
}
}
- return array($this->_attributes['name'] => $submitValues[$this->_attributes['name']]);
- } else {
- return null;
}
-
+ return $this->_prepareValue($draftitemid, $assoc);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.