From 67448ed9e1b10bb3f234496b5e678e83203c529e Mon Sep 17 00:00:00 2001
From: David Greiner <hallo@davidgreiner.de>
Date: Tue, 14 Jul 2015 23:28:56 +0200
Subject: [PATCH] [TASK] Hide clipboard menu selector if clipboard is empty

With this patch the clipboard menu selector becomes visible
if the clipboard is not empty.

Resolves: #68142
Releases: master
Change-Id: I9a0ec271da0b3e5aeeb97cff0b728f8faead9d72
Reviewed-on: http://review.typo3.org/41248
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/Clipboard/Clipboard.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Clipboard/Clipboard.php b/typo3/sysext/backend/Classes/Clipboard/Clipboard.php
index bb4a162a356b..3bb9b7bfbf64 100644
--- a/typo3/sysext/backend/Classes/Clipboard/Clipboard.php
+++ b/typo3/sysext/backend/Classes/Clipboard/Clipboard.php
@@ -268,9 +268,11 @@ class Clipboard {
 		if (!$this->fileMode && $elementCount) {
 			$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars(('window.location.href=' . GeneralUtility::quoteJSvalue($this->editUrl() . '&returnUrl=') . '+top.rawurlencode(window.location.href);')) . '">' . $this->clLabel('edit', 'rm') . '</a></li>';
 		}
+
 		$deleteLink = '';
-		// Delete:
+		$menuSelector = '';
 		if ($elementCount) {
+			// Delete:
 			$deleteLink = '<a class="btn btn-danger" href="' . htmlspecialchars($removeAllUrl) . '#clip_head">' . IconUtility::getSpriteIcon('actions-document-close', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:buttons.clear', TRUE))) . '</a>';
 			if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
 				$js = '
@@ -282,9 +284,9 @@ class Clipboard {
 				$js = ' window.location.href=' . GeneralUtility::quoteJSvalue($this->deleteUrl(0, ($this->fileMode ? 1 : 0)) . '&redirect=') . '+top.rawurlencode(window.location.href); ';
 			}
 			$optionArray[] = '<li><a href="#" onclick="' . htmlspecialchars($js) . '">' . $this->clLabel('delete', 'rm') . '</a></li>';
-		}
 
-		$menuSelector = '
+			// menuSelector
+			$menuSelector = '
 			<div class="btn-group">
 				<button class="btn btn-default dropdown-toggle" type="button" id="menuSelector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
 					' . $this->clLabel('menu', 'rm') . '
@@ -295,6 +297,7 @@ class Clipboard {
 				</ul>
 			</div>
 			';
+		}
 
 		$out[] = '
 			<tr>
-- 
GitLab