diff -u b/core/modules/inline_form_errors/src/FormErrorHandler.php b/core/modules/inline_form_errors/src/FormErrorHandler.php --- b/core/modules/inline_form_errors/src/FormErrorHandler.php +++ b/core/modules/inline_form_errors/src/FormErrorHandler.php @@ -53,8 +53,8 @@ * The current state of the form. */ protected function displayErrorMessages(array $form, FormStateInterface $form_state) { - // Use the original error display for Quick Edit forms, because they are - // already inline. + // Use the original error display for Quick Edit forms, because in this case + // the errors are already near the form element. if ($form['#form_id'] == 'quickedit_field_form') { parent::displayErrorMessages($form, $form_state); return; only in patch2: unchanged: --- a/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php +++ b/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php @@ -50,6 +50,7 @@ public function testDisplayErrorMessagesInline() { $form = [ '#parents' => [], + '#form_id' => 'test_form', ]; $form['test1'] = [ '#type' => 'textfield', @@ -114,6 +115,7 @@ public function testSetElementErrorsFromFormState() { $form = [ '#parents' => [], + '#form_id' => 'test_form', ]; $form['test'] = [ '#type' => 'textfield', @@ -127,4 +129,34 @@ public function testSetElementErrorsFromFormState() { $this->assertSame('invalid', $form['test']['#errors']); } + /** + * Test that Quick Edit forms show non-inline errors. + * + * @covers ::handleFormErrors + * @covers ::displayErrorMessages + */ + public function testDisplayErrorMessagesNotInlineQuickEdit() { + $form_error_handler = $this->getMockBuilder(FormErrorHandler::class) + ->setConstructorArgs([$this->getStringTranslationStub(), $this->getMock(LinkGeneratorInterface::class), $this->getMock(RendererInterface::class)]) + ->setMethods(['drupalSetMessage']) + ->getMock(); + + $form_error_handler->expects($this->at(0)) + ->method('drupalSetMessage') + ->with('invalid', 'error'); + + $form = [ + '#parents' => [], + '#form_id' => 'quickedit_field_form', + ]; + $form['test'] = [ + '#type' => 'textfield', + '#title' => 'Test', + '#parents' => ['test'], + '#id' => 'edit-test', + ]; + $form_state = new FormState(); + $form_state->setErrorByName('test', 'invalid'); + $form_error_handler->handleFormErrors($form, $form_state); + } }