setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath)); $view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']); $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $feCacheClear = $this->getBackendUser()->isAdmin() || $this->getBackendUser()->getTSConfig()['options.']['clearCache.']['pages']; $view->assignMultiple( [ 'isEnabled' => $this->getBackendUser()->uc['AdminPanel']['display_cache'], 'noCache' => $this->getBackendUser()->uc['AdminPanel']['cache_noCache'], 'currentId' => $this->getTypoScriptFrontendController()->id, 'clearPageCacheUrl' => $feCacheClear ? (string)$uriBuilder->buildUriFromRoute('tce_db', ['cacheCmd' => 'pages']) : '', 'clearCurrentPageCacheUrl' => (string)$uriBuilder->buildUriFromRoute( 'tce_db', [ 'cacheCmd' => $this->getTypoScriptFrontendController()->id, ] ), ] ); return $view->render(); } /** * @inheritdoc */ public function getIdentifier(): string { return 'cache'; } /** * @inheritdoc */ public function getLabel(): string { $locallangFileAndPath = 'LLL:EXT:adminpanel/Resources/Private/Language/locallang_cache.xlf:module.label'; return $this->getLanguageService()->sL($locallangFileAndPath); } /** * @inheritdoc */ public function initializeModule(ServerRequestInterface $request): void { if ($this->configurationService->getConfigurationOption('cache', 'noCache')) { $this->getTypoScriptFrontendController()->set_no_cache('Admin Panel: No Caching', true); } } /** * @return TypoScriptFrontendController */ protected function getTypoScriptFrontendController(): TypoScriptFrontendController { return $GLOBALS['TSFE']; } /** * @return array */ public function getJavaScriptFiles(): array { return ['EXT:adminpanel/Resources/Public/JavaScript/Modules/Cache.js']; } /** * Returns a string array with css files that will be rendered after the module * * Example: return ['EXT:adminpanel/Resources/Public/JavaScript/Modules/Edit.css']; * * @return array */ public function getCssFiles(): array { return []; } }