ModifyClearCacheActionsEvent

New in version 11.4

The ModifyClearCacheActionsEvent is fired in the ClearCacheToolbarItem 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 cacheActions and cacheActionIdentifiers arrays.

Example

Registration of the event in the Services.yaml:

EXT:some_extension/Configuration/Services.yaml
Vendor\SomeExtension\Toolbar\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-package/toolbar/my-event-listener'
Copied!

The corresponding event listener class:

EXT:some_extension/Classes/EventListener/MyEventListener.php
use TYPO3\CMS\Backend\Backend\Event\ModifyClearCacheActionsEvent;

final class MyEventListener {

    public function __invoke(ModifyClearCacheActionsEvent $event): void
    {
        // do magic here
    }

}
Copied!

The cache action array element consists of the following keys and values:

Example cache action array
[
    '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'
]
Copied!

API

class \TYPO3\CMS\Backend\Backend\Event\ ModifyClearCacheActionsEvent

An event to modify the clear cache actions, shown in the TYPO3 Backend top toolbar

addCacheAction ( array $cacheAction)
param array $cacheAction

the cacheAction

setCacheActions ( array $cacheActions)
param array $cacheActions

the cacheActions

getCacheActions ( )
returntype

array

addCacheActionIdentifier ( string $cacheActionIdentifier)
param string $cacheActionIdentifier

the cacheActionIdentifier

setCacheActionIdentifiers ( array $cacheActionIdentifiers)
param array $cacheActionIdentifiers

the cacheActionIdentifiers

getCacheActionIdentifiers ( )
returntype

array