TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
SiteProcessor.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
namespace
TYPO3\CMS\Frontend\DataProcessing
;
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
18
use
TYPO3\CMS\Core\Exception\SiteNotFoundException
;
19
use
TYPO3\CMS\Core\Routing\SiteMatcher
;
20
use
TYPO3\CMS\Core\Site\Entity\SiteInterface
;
21
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
22
use
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
;
23
use
TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface
;
24
37
class
SiteProcessor
implements
DataProcessorInterface
38
{
39
47
public
function
process
(
ContentObjectRenderer
$cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData): array
48
{
49
$targetVariableName = $cObj->
stdWrapValue
(
'as'
, $processorConfiguration,
'site'
);
50
$processedData[$targetVariableName] = $this->
getCurrentSite
();
51
return
$processedData;
52
}
53
59
protected
function
getCurrentSite
(): ?
SiteInterface
60
{
61
try
{
62
return
$this->
getMatcher
()->
matchByPageId
($this->
getCurrentPageId
());
63
}
catch
(
SiteNotFoundException
$e) {
64
// Do nothing
65
}
66
67
return
null
;
68
}
69
73
protected
function
getMatcher
():
SiteMatcher
74
{
75
return
GeneralUtility::makeInstance(SiteMatcher::class);
76
}
77
81
protected
function
getCurrentPageId
(): int
82
{
83
return
(
int
)
$GLOBALS
[
'TSFE'
]->id;
84
}
85
}
TYPO3\CMS\Core\Site\Entity\SiteInterface
Definition:
SiteInterface.php:25
TYPO3\CMS\Frontend\DataProcessing\SiteProcessor
Definition:
SiteProcessor.php:38
TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\getCurrentPageId
int getCurrentPageId()
Definition:
SiteProcessor.php:81
TYPO3\CMS\Core\Exception\SiteNotFoundException
Definition:
SiteNotFoundException.php:25
TYPO3\CMS\Frontend\DataProcessing
Definition:
CommaSeparatedValueProcessor.php:2
TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\getCurrentSite
SiteInterface null getCurrentSite()
Definition:
SiteProcessor.php:59
TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface
Definition:
DataProcessorInterface.php:22
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\stdWrapValue
string stdWrapValue($key, array $config, $defaultValue='')
Definition:
ContentObjectRenderer.php:1637
$GLOBALS
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition:
ext_localconf.php:5
TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\getMatcher
SiteMatcher getMatcher()
Definition:
SiteProcessor.php:73
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition:
ContentObjectRenderer.php:91
TYPO3\CMS\Core\Routing\SiteMatcher\matchByPageId
SiteInterface matchByPageId(int $pageId, array $rootLine=null)
Definition:
SiteMatcher.php:221
TYPO3\CMS\Core\Utility\GeneralUtility
Definition:
GeneralUtility.php:45
TYPO3\CMS\Core\Routing\SiteMatcher
Definition:
SiteMatcher.php:53
TYPO3\CMS\Frontend\DataProcessing\SiteProcessor\process
array process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
Definition:
SiteProcessor.php:47
doxygen
typo3
sysext
frontend
Classes
DataProcessing
SiteProcessor.php
Generated on Tue Oct 5 2021 01:57:44 for TYPO3CMS by
1.8.18