diff --git a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php index 4d2d8fa..17dbe9d 100644 --- a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php +++ b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php @@ -3,7 +3,7 @@ namespace Drupal\Core\Form\EventSubscriber; use Drupal\Core\Ajax\AjaxResponse; -use Drupal\Core\Ajax\ReplaceCommand; +use Drupal\Core\Ajax\PrependCommand; use Drupal\Core\EventSubscriber\MainContentViewSubscriber; use Drupal\Core\Form\Exception\BrokenPostRequestException; use Drupal\Core\Form\FormAjaxException; @@ -78,7 +78,7 @@ public function onException(GetResponseForExceptionEvent $event) { $this->drupalSetMessage($this->t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', ['@size' => $this->formatSize($exception->getSize())]), 'error'); $response = new AjaxResponse(); $status_messages = ['#type' => 'status_messages']; - $response->addCommand(new ReplaceCommand(NULL, $status_messages)); + $response->addCommand(new PrependCommand(NULL, $status_messages)); $response->headers->set('X-Status-Code', 200); $event->setResponse($response); return; diff --git a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php index 050d745..278ec06 100644 --- a/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php @@ -181,7 +181,7 @@ public function testOnExceptionBrokenPostRequest() { $this->assertSame(200, $actual_response->headers->get('X-Status-Code')); $expected_commands[] = [ 'command' => 'insert', - 'method' => 'replaceWith', + 'method' => 'prepend', 'selector' => NULL, 'data' => $rendered_output, 'settings' => NULL,