[TASK] Hide msg "Show hidden content elements" if none are hidden 81/41081/2
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 10 Jul 2015 08:43:04 +0000 (10:43 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 10 Jul 2015 09:07:33 +0000 (11:07 +0200)
To improve the usability the message and checkbox should only be
shown if there are elements actually hidden.

Change-Id: I0bb652ce915d1e8896b38bf3f94ae2a276cc3881
Resolves: #68037
Releases: master
Reviewed-on: http://review.typo3.org/41081
Reviewed-by: David Greiner <hallo@davidgreiner.de>
Tested-by: David Greiner <hallo@davidgreiner.de>
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Tested-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/PageLayoutController.php

index 0e5f064..85aefaa 100644 (file)
@@ -909,17 +909,18 @@ class PageLayoutController {
                }
                // Bottom controls (function menus):
                $q_count = $this->getNumberOfHiddenElements();
+               if ($q_count) {
+                       $h_func_b = '<div class="checkbox">' .
+                               '<label for="checkTt_content_showHidden">' .
+                               BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"') .
+                               (!$q_count ? ('<span class="text-muted">' . $lang->getLL('hiddenCE', TRUE) . '</span>') : $lang->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') .
+                               '</label>' .
+                               '</div>';
+
+                       $content .= $this->doc->section('', $h_func_b, 0, 0);
+                       $content .= $this->doc->spacer(10);
+               }
 
-               $h_func_b = '<div class="checkbox">' .
-                                       '<label for="checkTt_content_showHidden">' .
-                                       BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"') .
-                                       (!$q_count ? ('<span class="text-muted">' . $lang->getLL('hiddenCE', TRUE) . '</span>') : $lang->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') .
-                                       '</label>' .
-                                       '</div>';
-
-               // Add the function menus to bottom:
-               $content .= $this->doc->section('', $h_func_b, 0, 0);
-               $content .= $this->doc->spacer(10);
                // Select element matrix:
                if ($this->eRParts[0] == 'tt_content' && MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
                        $posMap = GeneralUtility::makeInstance(ContentLayoutPagePositionMap::class);
@@ -978,14 +979,15 @@ class PageLayoutController {
                        if (!isset($dbList->externalTables[$table])) {
                                $q_count = $this->getNumberOfHiddenElements();
 
-                               $h_func_b =
-                                       '<div class="checkbox">'
+                               if ($q_count > 0) {
+                                       $h_func_b =
+                                               '<div class="checkbox">'
                                                . '<label for="checkTt_content_showHidden">'
-                                                       . '<input type="checkbox" id="checkTt_content_showHidden" class="checkbox" name="SET[tt_content_showHidden]" value="1" ' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? 'checked="checked"' : '') . ' />'
-                                                       . $this->getLanguageService()->getLL('hiddenCE', TRUE) . ' (<span class="t3js-hidden-counter">' . $q_count . '</span>)'
+                                               . '<input type="checkbox" id="checkTt_content_showHidden" class="checkbox" name="SET[tt_content_showHidden]" value="1" ' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? 'checked="checked"' : '') . ' />'
+                                               . $this->getLanguageService()->getLL('hiddenCE', TRUE) . ' (<span class="t3js-hidden-counter">' . $q_count . '</span>)'
                                                . '</label>'
-                                       . '</div>';
-
+                                               . '</div>';
+                               }
                                // Boolean: Display up/down arrows and edit icons for tt_content records
                                $dbList->tt_contentConfig['showCommands'] = 1;
                                // Boolean: Display info-marks or not