From c13a28400ed06c03b7517afc28ecadbe995e34c0 Mon Sep 17 00:00:00 2001
From: Johannes Schlier <johannes.schlier@b13.de>
Date: Tue, 30 May 2017 17:23:24 +0200
Subject: [PATCH] [BUGFIX] Remove disabled button in inline records

If the info icon is disabled it is now removed completely.
Previously the logic for new records was not caught correctly, so that
the case for the enabled icon with a new record was executed.
Disabling the icon should remove it completely,
as a disabled non-clickable icon is not helpful and confusing for editors.
This is now done, and the case for the enabled icon with new records is
also correctly caught.

Resolves: #81380
Releases: master, 8.7
Change-Id: I1c78a99a83efa3c88e3a6337df9cd0c8a959ea7b
Reviewed-on: https://review.typo3.org/52970
Reviewed-by: Daniel Windloff <daniel.jc.windloff@googlemail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Sommer <markussom@posteo.de>
Tested-by: Markus Sommer <markussom@posteo.de>
Tested-by: Daniel Windloff <daniel.jc.windloff@googlemail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Classes/Form/Container/InlineRecordContainer.php   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php b/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
index a67800777d91..415ca2c1ad76 100644
--- a/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
+++ b/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
@@ -434,13 +434,15 @@ class InlineRecordContainer extends AbstractContainer
             $uid = $rec['uid'];
             $table = $foreignTable;
         }
-        if ($enabledControls['info'] && !$isNewItem) {
-            $cells['info'] = '
+        if ($enabledControls['info']) {
+            if ($isNewItem) {
+                $cells['info'] = '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
+            } else {
+                $cells['info'] = '
 				<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:showInfo')) . '">
 					' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '
 				</a>';
-        } else {
-            $cells['info'] = '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
+            }
         }
         // If the table is NOT a read-only table, then show these links:
         if (!$tcaTableCtrl['readOnly'] && !$data['isInlineDefaultLanguageRecordInLocalizedParentContext']) {
-- 
GitLab