Issue #2644468: Multiple image upload breaks image dimensions
2 unresolved threads
Merge request reports
Activity
- Resolved by mondrake
- Resolved by mondrake
- Resolved by mondrake
- Resolved by Lee Rowlands
added 9 commits
-
8d370b53...c5489de5 - 8 commits from branch
project:9.2.x
- bfb789c8 - Merge branch '9.2.x' into 2644468-multiple-image-upload
-
8d370b53...c5489de5 - 8 commits from branch
185 186 return $element; 186 187 } 187 188 189 /** 190 * {@inheritdoc} 191 */ 192 public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { 193 // Since the file upload widget now supports uploads of more than one file 194 // at a time it always returns an array of fids. We have to translate this 195 // to a single fid, as the field expects a single value. In this process, we 196 // have to unset any image dimension for files other than the first, so that 197 // the dimensions are not copied from those of the first file. 198 $new_values = []; 199 foreach ($values as &$value) { 335 $field_name = $element['#field_name']; 336 $parents = $element['#field_parents']; 337 338 $submitted_values = NestedArray::getValue($form_state->getValues(), array_slice($button['#parents'], 0, -2)); 339 foreach ($submitted_values as $delta => $submitted_value) { 340 if (empty($submitted_value['fids'])) { 341 unset($submitted_values[$delta]); 342 } 343 } 344 345 // If there are more files uploaded via the same widget, we have to 346 // separate them, as we display each file in its own widget. In this 347 // process, we have to unset any image dimension for files after the first, 348 // that would otherwise be copied from those of the first file. 349 $new_values = []; 350 foreach ($submitted_values as $delta => $submitted_value) {
Please register or sign in to reply