Commit e8eb54cc authored by git's avatar git Committed by joseph.olstad

Issue #2834464 by ann b: Multiple Files Attached in Reverse Order

parent 51eaec01
......@@ -309,7 +309,13 @@ function media_field_widget_process_multiple($element, &$form_state, $form) {
// For each file selected, increment the field key to be processed.
// field_mediafield_und_0 becomes field_mediafield_und_1, etc.
$_POST['media'][$upload_name_prefix . ($element['#file_upload_delta'] + $i)] = $files[$i];
$element[] = $element[$element['#file_upload_delta']];
// Copy the default file element to each newly selected file position.
$default_element = $element[$element['#file_upload_delta']];
$element[] = array_merge(
$default_element,
array('#weight' => ($element['#file_upload_delta'] + $i + 1))
);
}
}
......
......@@ -94,8 +94,6 @@ Drupal.media.openBrowser = function (event) {
var mediaFileValue;
// Process the value based on multiselect.
if (mediaFiles.length > 1) {
// Reverse array to have files in correct order
mediaFiles.reverse();
// Concatenate the array into a comma separated string.
mediaFileValue = mediaFiles.map(function(file) {
return file.fid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment