diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php index 5a420155fba6c2f3a733fbbef676f671d5e8c20c..df33469e40acd733a2dc52a1969d139cc81459e1 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php @@ -122,14 +122,22 @@ class ClearCacheToolbarItem implements ToolbarItemInterface */ public function getItem() { - $icon = $this->iconFactory->getIcon('apps-toolbar-menu-cache', Icon::SIZE_SMALL)->render('inline'); - - $view = $this->getFluidTemplateObject('ClearCacheToolbarItem.html'); - $view->assignMultiple([ + if ($this->hasDropDown()) { + $templateReference = 'ClearCacheToolbarItem.html'; + $icon = $this->iconFactory->getIcon('apps-toolbar-menu-cache', Icon::SIZE_SMALL)->render('inline'); + $variables = [ 'title' => 'LLL:EXT:lang/locallang_core.xlf:rm.clearCache_clearCache', 'icon' => $icon - ] - ); + ]; + } else { + $templateReference = 'ClearCacheToolbarItemSingle.html'; + $cacheAction = end($this->cacheActions); + $variables['link'] = $cacheAction['href']; + $variables['title'] = $cacheAction['title']; + $variables['icon'] = $cacheAction['icon']; + } + $view = $this->getFluidTemplateObject($templateReference); + $view->assignMultiple($variables); return $view->render(); } @@ -168,7 +176,7 @@ class ClearCacheToolbarItem implements ToolbarItemInterface */ public function hasDropDown() { - return true; + return count($this->cacheActions) > 1; } /** diff --git a/typo3/sysext/backend/Resources/Private/Partials/ToolbarItems/ToolbarItem.html b/typo3/sysext/backend/Resources/Private/Partials/ToolbarItems/ToolbarItem.html index efc8745787ce593ee93c21f46e3641c12a44c254..99e1d94ca8ead019906bd5295192411ad70a0419 100644 --- a/typo3/sysext/backend/Resources/Private/Partials/ToolbarItems/ToolbarItem.html +++ b/typo3/sysext/backend/Resources/Private/Partials/ToolbarItems/ToolbarItem.html @@ -1,4 +1,4 @@ {namespace core = TYPO3\CMS\Core\ViewHelpers} -<span class="toolbar-item-icon" title="{f:translate(key: title, htmlEscape: 'TRUE')}">{icon -> f:format.raw()}</span> +<span class="toolbar-item-icon" title="{f:translate(key: title, htmlEscape: 'TRUE', default: title)}">{icon -> f:format.raw()}</span> <span class="toolbar-item-title">{f:translate(key: title, htmlEscape: 'FALSE')}</span> \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemDropDown.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemDropDown.html index 9875fa8e70f7a273cca781fd92066c2420a0ade9..69d1296f27b3a25e2267e594e4c8723dc1c0d359 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemDropDown.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemDropDown.html @@ -5,7 +5,7 @@ <div class="dropdown-table"> <f:for each="{cacheActions}" as="cacheAction"> <div class="dropdown-table-row"> - <f:link.typolink parameter="{cacheAction.href}"> + <f:link.typolink parameter="{cacheAction.href}" class="toolbar-cache-flush-action"> <div class="dropdown-table-column dropdown-table-column-top dropdown-table-icon"> {cacheAction.icon -> f:format.raw()} </div> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html new file mode 100644 index 0000000000000000000000000000000000000000..8d4ca8d0ed08ba08a2be7306cdb37db67f370dfc --- /dev/null +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html @@ -0,0 +1,4 @@ +<f:link.typolink parameter="{link}" class="toolbar-cache-flush-action toolbar-item-link" title="{title}"> + <f:render partial="ToolbarItem" arguments="{title: title, icon: icon}"/> +</f:link.typolink> + diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js index b3ff39b1b7c48e33160bd4fea3cf218af580e522..22558fa61e5e415d01e80dfe1561f4402a1cc89d 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js @@ -27,7 +27,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons', 'TYPO3/CMS/Backend/Notification'], var ClearCacheMenu = { options: { containerSelector: '#typo3-cms-backend-backend-toolbaritems-clearcachetoolbaritem', - menuItemSelector: '.dropdown-menu a', + menuItemSelector: 'a.toolbar-cache-flush-action', toolbarIconSelector: '.toolbar-item-icon .t3js-icon', } };