[ 'type' => 'item', 'label' => 'Purge from SSR cache', 'iconIdentifier' => 'actions-system-cache-clear-impact-medium', 'callbackAction' => 'ssrPurge', ], ]; public function canHandle(): bool { return $this->table === 'pages'; } /** * Below the core PageProvider (100): we run after it and splice our * item into the finished menu, right behind "Clear cache". */ public function getPriority(): int { return 42; } public function addItems(array $items): array { if (!is_readable(Environment::getVarPath() . '/vitec-ssr-purge.env')) { return $items; } $page = BackendUtility::getRecord('pages', (int)$this->identifier, 'uid,doktype'); if ($page === null || (int)$page['doktype'] >= 199) { // Spacers, folders, recycler - nothing cached for those. return $items; } $this->initDisabledItems(); $localItems = $this->prepareItems($this->itemsConfiguration); if (isset($items['clearCache'])) { $new = []; foreach ($items as $key => $item) { $new[$key] = $item; if ($key === 'clearCache') { $new = array_merge($new, $localItems); } } return $new; } return array_merge($items, $localItems); } protected function getAdditionalAttributes(string $itemName): array { return ['data-callback-module' => '@evomedien/vitec/ssr-context-menu.js']; } }