Skip to content
Snippets Groups Projects
Commit de27f197 authored by catch's avatar catch
Browse files

Issue #2587755 by aerozeppelin, NickWilde, swentel: AJAX error when using...

Issue #2587755 by aerozeppelin, NickWilde, swentel: AJAX error when using progress bar on file field widget
parent d8cf1783
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
file.ajax_progress: file.ajax_progress:
path: '/file/progress' path: '/file/progress/{key}'
defaults: defaults:
_controller: '\Drupal\file\Controller\FileWidgetAjaxController::progress' _controller: '\Drupal\file\Controller\FileWidgetAjaxController::progress'
requirements: requirements:
......
...@@ -271,7 +271,7 @@ public static function processManagedFile(&$element, FormStateInterface $form_st ...@@ -271,7 +271,7 @@ public static function processManagedFile(&$element, FormStateInterface $form_st
} }
// Add the upload progress callback. // Add the upload progress callback.
$element['upload_button']['#ajax']['progress']['url'] = Url::fromRoute('file.ajax_progress'); $element['upload_button']['#ajax']['progress']['url'] = Url::fromRoute('file.ajax_progress', ['key' => $upload_progress_key]);
} }
// The file upload field itself. // The file upload field itself.
......
...@@ -447,6 +447,12 @@ public function testWidgetElement() { ...@@ -447,6 +447,12 @@ public function testWidgetElement() {
// If the field has at least a item, the table should be visible. // If the field has at least a item, the table should be visible.
$this->assertIdentical(count($elements), 1); $this->assertIdentical(count($elements), 1);
// Test for AJAX error when using progress bar on file field widget
$key = $this->randomMachineName();
$this->drupalPost('file/progress/' . $key, 'application/json', []);
$this->assertNoResponse(500, t('No AJAX error when using progress bar on file field widget'));
$this->assertText('Starting upload...');
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment