[TASK] Show reference headline only if content is available
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 8 Oct 2012 06:56:16 +0000 (08:56 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 8 Oct 2012 10:37:20 +0000 (12:37 +0200)
Currently the headline "References from this item" is
always shown in the info popup, no matter if there are
ones or not.

Therefore add an additional check and render the headline
only if needed.

Change-Id: I605d7ff35001f19fa6df2972b4ffde13cca60d7e
Resolves: #41665
Releases: 6.0
Reviewed-on: http://review.typo3.org/15389
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php

index cb644a8..911b733 100644 (file)
@@ -286,8 +286,14 @@ class ElementInformationController {
                $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table') . ': ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']) . ' (' . $this->table . ') - UID: ' . $this->uid . '<br />';
                $this->content .= $this->doc->section('', $code);
                // References:
-               $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $this->makeRef($this->table, $this->row['uid']));
-               $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), $this->makeRefFrom($this->table, $this->row['uid']));
+               $references = $this->makeRef($this->table, $this->row['uid']);
+               if (!empty($references)) {
+                       $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $references);
+               }
+               $referencesFrom = $this->makeRefFrom($this->table, $this->row['uid']);
+               if (!empty($referencesFrom)) {
+                       $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), $referencesFrom);
+               }
        }
 
        /**
@@ -354,8 +360,12 @@ class ElementInformationController {
                $this->content .= $this->doc->section('', $tableCode);
                // References:
                if ($this->fileObject->isIndexed()) {
-                       $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem');
-                       $this->content .= $this->doc->section($header, $this->makeRef('_FILE', $this->fileObject));
+                       $references = $this->makeRef('_FILE', $this->fileObject);
+
+                       if (!empty($references)) {
+                               $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem');
+                               $this->content .= $this->doc->section($header, $references);
+                       }
                }
        }