[BUGFIX] Hide empty descriptions in textmedia in page module 92/53092/2
authorJigal van Hemert <jigal.van.hemert@typo3.org>
Sat, 3 Jun 2017 15:30:39 +0000 (17:30 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 3 Jun 2017 15:49:26 +0000 (17:49 +0200)
In the Page module with textmedia content elements the descriptions
are shown below the thumbnails of linked media. If there is no
description an empty line is now suppressed.

Resolves: #81408
Releases: master, 8.7, 7.6
Change-Id: I9f342908f179550bcf2156328117c464bb8c672f
Reviewed-on: https://review.typo3.org/53092
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jo Hasenau <info@cybercraft.de>
Tested-by: Jo Hasenau <info@cybercraft.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/Hooks/PageLayoutView/TextmediaPreviewRenderer.php

index c4736da..5584d00 100644 (file)
@@ -53,7 +53,10 @@ class TextmediaPreviewRenderer implements PageLayoutViewDrawItemHookInterface
                     $linkedContent = '';
 
                     foreach ($fileReferences as $fileReference) {
-                        $linkedContent .= htmlspecialchars($fileReference->getDescription()) . '<br />';
+                        $description = $fileReference->getDescription();
+                        if ($description !== null && $description !== '') {
+                            $linkedContent .= htmlspecialchars($description) . '<br />';
+                        }
                     }
 
                     $itemContent .= $parentObject->linkEditContent($linkedContent, $row);