[BUGFIX] Avoid empty form-section divs 85/43385/2
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 17 Sep 2015 06:38:56 +0000 (08:38 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 17 Sep 2015 08:41:39 +0000 (10:41 +0200)
If flexform conditions are used it might be that the form-section is
empty. Render the div only if there is something to show.

Change-Id: I5942b8ee4f7b8cde4bc0f557cf3a4939d740b7aa
Resolves: #69907
Releases: master
Reviewed-on: http://review.typo3.org/43385
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php

index 8f4bba4..75852af 100644 (file)
@@ -92,7 +92,6 @@ class FlexFormElementContainer extends AbstractContainer {
                                        $lkeys = array($vDEFkey);
                                }
                                $html = array();
-                               $html[] = '<div class="form-section">';
                                foreach ($lkeys as $lkey) {
                                        $displayConditionResult = TRUE;
                                        if (!empty($flexFormFieldArray['displayCond'])) {
@@ -180,9 +179,10 @@ class FlexFormElementContainer extends AbstractContainer {
                                        $html[] = '</div>';
                                        $html[] = '</div>';
                                }
-                               $html[] = '</div>';
 
-                               $resultArray['html'] .= implode(LF, $html);
+                               if (!empty($html)) {
+                                       $resultArray['html'] .= '<div class="form-section">' . implode(LF, $html) . '</div>';
+                               }
                                $childResult['html'] = '';
                                $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $childResult);
                        }