‪TYPO3CMS  10.4
PageTitle.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ServerRequestInterface;
27 
34 {
38  protected const ‪LOG_COMPONENT = 'TYPO3.CMS.Core.PageTitle.PageTitleProviderManager';
39 
46  public function ‪getIdentifier(): string
47  {
48  return 'debug_pagetitle';
49  }
50 
56  public function ‪getLabel(): string
57  {
58  return $this->‪getLanguageService()->‪sL(
59  'LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:submodule.pageTitle.label'
60  );
61  }
62 
67  public function ‪getDataToStore(ServerRequestInterface $request): ‪ModuleData
68  {
69  $data = [
70  'cacheEnabled' => true
71  ];
72  if ($this->‪isNoCacheEnabled()) {
73  $data = [
74  'orderedProviders' => [],
75  'usedProvider' => null,
76  'skippedProviders' => []
77  ];
78 
81  foreach ($log as $logEntry) {
82  if ($logEntry->getComponent() === self::LOG_COMPONENT) {
83  if (isset($logEntry->getData()['orderedTitleProviders'])) {
84  $data['orderedProviders'] = $logEntry->‪getData()['orderedTitleProviders'];
85  } elseif (isset($logEntry->getData()['providerUsed'])) {
86  $data['usedProvider'] = $logEntry->getData();
87  } elseif (isset($logEntry->getData()['skippedProvider'])) {
88  $data['skippedProviders'][] = $logEntry->getData();
89  }
90  }
91  }
92  }
93  return new ‪ModuleData($data);
94  }
95 
100  public function ‪getContent(‪ModuleData $data): string
101  {
102  $view = new ‪StandaloneView();
103  $view->setTemplatePathAndFilename(
104  'EXT:adminpanel/Resources/Private/Templates/Modules/Debug/PageTitle.html'
105  );
106  $this->‪getLanguageService()->‪includeLLFile('EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf');
107  $view->assignMultiple($data->getArrayCopy());
108  $view->assign('languageKey', $this->‪getBackendUser()->user['lang']);
109  return $view->render();
110  }
111 
115  protected function ‪isNoCacheEnabled(): bool
116  {
117  return (bool)$this->‪getTypoScriptFrontendController()->no_cache;
118  }
119 
124  {
125  return ‪$GLOBALS['TSFE'];
126  }
127 }
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪array includeLLFile($fileRef, $setGlobal=null, $mergeLocalOntoDefault=null)
Definition: LanguageService.php:297
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\isNoCacheEnabled
‪bool isNoCacheEnabled()
Definition: PageTitle.php:115
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule\getLanguageService
‪LanguageService getLanguageService()
Definition: AbstractSubModule.php:35
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\getIdentifier
‪string getIdentifier()
Definition: PageTitle.php:46
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\getTypoScriptFrontendController
‪TypoScriptFrontendController getTypoScriptFrontendController()
Definition: PageTitle.php:123
‪TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface
Definition: DataProviderInterface.php:30
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\getDataToStore
‪TYPO3 CMS Adminpanel ModuleApi ModuleData getDataToStore(ServerRequestInterface $request)
Definition: PageTitle.php:67
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule\getBackendUser
‪getBackendUser()
Definition: AbstractSubModule.php:40
‪TYPO3\CMS\Core\Log\LogRecord\getData
‪array getData()
Definition: LogRecord.php:187
‪TYPO3\CMS\Adminpanel\Modules\Debug
Definition: Events.php:18
‪TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter
Definition: InMemoryLogWriter.php:31
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\getLabel
‪string getLabel()
Definition: PageTitle.php:56
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:34
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:98
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle
Definition: PageTitle.php:34
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\LOG_COMPONENT
‪const LOG_COMPONENT
Definition: PageTitle.php:38
‪TYPO3\CMS\Adminpanel\ModuleApi\ModuleData
Definition: ModuleData.php:27
‪TYPO3\CMS\Adminpanel\Modules\Debug\PageTitle\getContent
‪string getContent(ModuleData $data)
Definition: PageTitle.php:100
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule
Definition: AbstractSubModule.php:29
‪TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter\$log
‪static LogRecord[] $log
Definition: InMemoryLogWriter.php:34