[BUGFIX] Prevent empty new form from being closed without confirmation 37/60237/2
authorWolfgang Klinger <wolfgang@wazum.com>
Wed, 13 Mar 2019 15:23:31 +0000 (16:23 +0100)
committerDaniel Goerz <daniel.goerz@posteo.de>
Sat, 16 Mar 2019 11:01:12 +0000 (12:01 +0100)
Set ‘has-change’ on new empty content element form container
to trigger the confirmation dialog when using ‘Close’.

Resolves: #87890
Releases: master, 9.5
Change-Id: Idc3d8fdca0f865991ee09935f4b75683dffb4d7e
Reviewed-on: https://review.typo3.org/c/60237
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/backend/Classes/Form/Container/OuterWrapContainer.php
typo3/sysext/backend/Resources/Private/Templates/OuterWrapContainer.html

index f6195a7..a9e7239 100644 (file)
@@ -144,7 +144,8 @@ class OuterWrapContainer extends AbstractContainer
             'childHtml' => $childHtml,
             'icon' => $icon,
             'tableTitle' => $tableTitle,
-            'newOrUid' => $newOrUid
+            'newOrUid' => $newOrUid,
+            'isNewRecord' => $this->data['command'] === 'new'
         ]);
         $result['html'] = $view->render();
         return $result;
index 738b409..35b4406 100644 (file)
@@ -11,7 +11,7 @@
        </f:be.infobox>
 </f:if>
 
-<div class="typo3-TCEforms">
+<div class="typo3-TCEforms{f:if(condition:isNewRecord, then:' has-change')}">
        <f:format.raw>{fieldInformationHtml}</f:format.raw>
        <f:format.raw>{fieldWizardHtml}</f:format.raw>
        <f:format.raw>{childHtml}</f:format.raw>