diff --git a/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php b/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php index 25c75136b973ebcc27c9dc4b5c91372566ed5715..be1064f80c894795d594da0e659e411a216bf4d5 100644 --- a/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php +++ b/typo3/sysext/backend/Classes/Controller/FormInlineAjaxController.php @@ -23,6 +23,8 @@ use TYPO3\CMS\Backend\Form\InlineStackProcessor; use TYPO3\CMS\Backend\Form\NodeFactory; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\DataHandling\DataHandler; +use TYPO3\CMS\Core\Messaging\AbstractMessage; +use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; @@ -348,6 +350,23 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController $oldItems = $this->getInlineRelatedRecordsUidArray($oldItemList); $newItems = $this->getInlineRelatedRecordsUidArray($newItemList); + // Render error messages from DataHandler + $tce->printLogErrorMessages(); + $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); + $messages = $flashMessageService->getMessageQueueByIdentifier()->getAllMessagesAndFlush(); + if (!empty($messages)) { + foreach ($messages as $message) { + $jsonArray['messages'][] = [ + 'title' => $message->getTitle(), + 'message' => $message->getMessage(), + 'severity' => $message->getSeverity() + ]; + if ($message->getSeverity() === AbstractMessage::ERROR) { + $jsonArray['hasErrors'] = true; + } + } + } + // Set the items that should be removed in the forms view: $removedItems = array_diff($oldItems, $newItems); foreach ($removedItems as $childUid) { diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js b/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js index 51ae6298b43a2bb306e6ccbcfa46815dee648f81..cbf9c07eb4436e00c8fb5cb4147b100df026d1bc 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js @@ -233,6 +233,11 @@ var inline = { if (!json && xhr) { json = xhr.responseJSON; } + if (json.hasErrors) { + $.each(json.messages, function(position, message) { + top.TYPO3.Notification.error(message.title, message.message); + }); + } // If there are elements the should be added to the <HEAD> tag (e.g. for RTEhtmlarea): if (json.stylesheetFiles) { $.each(json.stylesheetFiles, function (index, stylesheetFile) {