Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
ModifyClearCacheActionsEvent
New in version 11.4
The Modify
is fired in the Clear
class and allows extensions to modify the clear cache actions, shown
in the TYPO3 backend top toolbar.
The event can be used to change or remove existing clear cache
actions, as well as to add new actions. Therefore the event also
contains, next to the usual "getter" and "setter" methods, the convenience
method add
for the cache
and
cache
arrays.
Example
Registration of the event in the Services.
:
Vendor\SomeExtension\Toolbar\MyEventListener:
tags:
- name: event.listener
identifier: 'my-package/toolbar/my-event-listener'
The corresponding event listener class:
use TYPO3\CMS\Backend\Backend\Event\ModifyClearCacheActionsEvent;
final class MyEventListener {
public function __invoke(ModifyClearCacheActionsEvent $event): void
{
// do magic here
}
}
The cache action array element consists of the following keys and values:
[
'id' => 'pages',
'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushPageCachesTitle',
'description' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushPageCachesDescription',
'href' => (string)$uriBuilder->buildUriFromRoute('tce_db', ['cacheCmd' => 'pages']),
'iconIdentifier' => 'actions-system-cache-clear-impact-low'
]
API
- class ModifyClearCacheActionsEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Backend\ Backend\ Event\ Modify Clear Cache Actions Event
An event to modify the clear cache actions, shown in the TYPO3 Backend top toolbar
- addCacheActionIdentifier ( string $cacheActionIdentifier)
-
- param string $cacheActionIdentifier
-
the cacheActionIdentifier