‪TYPO3CMS  11.5
SiteProcessor.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 
21 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
24 
38 {
40 
42  {
43  $this->tsfe = ‪$tsfe ?? ‪$GLOBALS['TSFE'] ?? null;
44  }
45 
53  public function ‪process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData): array
54  {
55  $targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration, 'site');
56  $processedData[$targetVariableName] = $this->‪getCurrentSite();
57  return $processedData;
58  }
59 
65  protected function ‪getCurrentSite(): ?‪Site
66  {
67  if ($this->tsfe instanceof ‪TypoScriptFrontendController) {
68  return $this->tsfe->getSite();
69  }
70  return null;
71  }
72 }
‪TYPO3\CMS\Frontend\DataProcessing\SiteProcessor
Definition: SiteProcessor.php:38
‪TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\$tsfe
‪TypoScriptFrontendController $tsfe
Definition: SiteProcessor.php:39
‪TYPO3\CMS\Frontend\DataProcessing
Definition: CommaSeparatedValueProcessor.php:16
‪TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\getCurrentSite
‪Site null getCurrentSite()
Definition: SiteProcessor.php:65
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:42
‪TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface
Definition: DataProcessorInterface.php:23
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:104
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\__construct
‪__construct(TypoScriptFrontendController $tsfe=null)
Definition: SiteProcessor.php:41
‪TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\process
‪array process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
Definition: SiteProcessor.php:53