ModifyClearCacheActionsEvent
New in version 11.4
The PSR-14 event \TYPO3\
is fired in the \TYPO3\
class and allows extension authors 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
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Backend\EventListener;
use TYPO3\CMS\Backend\Backend\Event\ModifyClearCacheActionsEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
#[AsEventListener(
identifier: 'my-extension/toolbar/my-event-listener',
)]
final readonly class MyEventListener
{
public function __invoke(ModifyClearCacheActionsEvent $event): void
{
// do magic here
}
}
New in version 13.0
The PHP attribute \TYPO3\
has been
introduced to tag a PHP class as an event listener. Alternatively, or if you
need to be compatible with older TYPO3 versions, you can also register an
event listener via the Configuration/
file. Switch to
an older version of this page for an example or have a look at the section
Implementing an event listener in your extension.
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 $cacheActionIdentifier
-
the cacheActionIdentifier