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
LanguageAspect.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
namespace
TYPO3\CMS\Core\Context
;
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\Context\Exception\AspectPropertyNotFoundException
;
19
54
class
LanguageAspect
implements
AspectInterface
55
{
59
protected
$id
= 0;
60
64
protected
$contentId
= 0;
65
69
protected
$fallbackChain
= [];
70
74
protected
$overlayType
;
75
76
public
const
OVERLAYS_OFF
=
'off'
;
// config.sys_language_overlay = 0
77
public
const
OVERLAYS_MIXED
=
'mixed'
;
// config.sys_language_overlay = 1 (keep the ones that are only available in default language)
78
public
const
OVERLAYS_ON
=
'on'
;
// "hideNonTranslated"
79
public
const
OVERLAYS_ON_WITH_FLOATING
=
'includeFloating'
;
// "hideNonTranslated" + records that are only available in polish
80
89
public
function
__construct
(
int
$id
= 0,
int
$contentId
=
null
,
string
$overlayType
= self::OVERLAYS_ON_WITH_FLOATING, array
$fallbackChain
= [])
90
{
91
$this->overlayType =
$overlayType
;
92
$this->
id
=
$id
;
93
$this->contentId =
$contentId
===
null
? $this->id :
$contentId
;
94
$this->fallbackChain =
$fallbackChain
;
95
}
96
102
public
function
getOverlayType
(): string
103
{
104
return
$this->overlayType
;
105
}
106
113
public
function
getId
(): int
114
{
115
return
$this->id
;
116
}
117
125
public
function
getContentId
(): int
126
{
127
return
$this->contentId
;
128
}
129
130
public
function
getFallbackChain
(): array
131
{
132
return
$this->fallbackChain
;
133
}
134
140
public
function
doOverlays
(): bool
141
{
142
return
$this->contentId > 0 && $this->overlayType !==
self::OVERLAYS_OFF
;
143
}
144
150
public
function
getLegacyLanguageMode
(): string
151
{
152
if
($this->fallbackChain === [
'off'
]) {
153
return
''
;
154
}
155
if
(empty($this->fallbackChain)) {
156
return
'strict'
;
157
}
158
if
($this->fallbackChain === [-1]) {
159
return
'ignore'
;
160
}
161
return
'content_fallback'
;
162
}
163
169
public
function
getLegacyOverlayType
(): string
170
{
171
switch
($this->overlayType) {
172
case
self::OVERLAYS_ON_WITH_FLOATING
:
173
case
self::OVERLAYS_ON
:
174
return
'hideNonTranslated'
;
175
case
self::OVERLAYS_MIXED
:
176
return
'1'
;
177
case
self::OVERLAYS_OFF
:
178
default
:
179
return
'0'
;
180
}
181
}
182
190
public
function
get
(
string
$name)
191
{
192
switch
($name) {
193
case
'id'
:
194
return
$this->id
;
195
case
'contentId'
:
196
return
$this->contentId
;
197
case
'fallbackChain'
:
198
return
$this->fallbackChain
;
199
case
'overlayType'
:
200
return
$this->overlayType
;
201
case
'legacyLanguageMode'
:
202
return
$this->
getLegacyLanguageMode
();
203
case
'legacyOverlayType'
:
204
return
$this->
getLegacyOverlayType
();
205
}
206
throw
new
AspectPropertyNotFoundException(
'Property "'
. $name .
'" not found in Aspect "'
. __CLASS__ .
'".'
, 1530448504);
207
}
208
}
TYPO3\CMS\Core\Context\LanguageAspect\$overlayType
string $overlayType
Definition:
LanguageAspect.php:70
TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_MIXED
const OVERLAYS_MIXED
Definition:
LanguageAspect.php:73
TYPO3\CMS\Core\Context\LanguageAspect\getContentId
int getContentId()
Definition:
LanguageAspect.php:121
TYPO3\CMS\Core\Context\LanguageAspect\getLegacyLanguageMode
string getLegacyLanguageMode()
Definition:
LanguageAspect.php:146
TYPO3\CMS\Core\Context\LanguageAspect\getId
int getId()
Definition:
LanguageAspect.php:109
TYPO3\CMS\Core\Context
Definition:
AspectInterface.php:3
TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON
const OVERLAYS_ON
Definition:
LanguageAspect.php:74
TYPO3\CMS\Core\Context\LanguageAspect\$id
int $id
Definition:
LanguageAspect.php:58
TYPO3\CMS\Core\Context\LanguageAspect\getFallbackChain
getFallbackChain()
Definition:
LanguageAspect.php:126
TYPO3\CMS\Core\Context\AspectInterface
Definition:
AspectInterface.php:25
TYPO3\CMS\Core\Context\LanguageAspect\getOverlayType
string getOverlayType()
Definition:
LanguageAspect.php:98
TYPO3\CMS\Core\Context\LanguageAspect\__construct
__construct(int $id=0, int $contentId=null, string $overlayType=self::OVERLAYS_ON_WITH_FLOATING, array $fallbackChain=[])
Definition:
LanguageAspect.php:85
TYPO3\CMS\Core\Context\LanguageAspect\$contentId
int $contentId
Definition:
LanguageAspect.php:62
TYPO3\CMS\Core\Context\LanguageAspect
Definition:
LanguageAspect.php:55
TYPO3\CMS\Core\Context\LanguageAspect\$fallbackChain
array $fallbackChain
Definition:
LanguageAspect.php:66
TYPO3\CMS\Core\Context\LanguageAspect\getLegacyOverlayType
string getLegacyOverlayType()
Definition:
LanguageAspect.php:165
TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_OFF
const OVERLAYS_OFF
Definition:
LanguageAspect.php:72
TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON_WITH_FLOATING
const OVERLAYS_ON_WITH_FLOATING
Definition:
LanguageAspect.php:75
TYPO3\CMS\Core\Context\LanguageAspect\doOverlays
bool doOverlays()
Definition:
LanguageAspect.php:136
TYPO3\CMS\Core\Context\Exception\AspectPropertyNotFoundException
Definition:
AspectPropertyNotFoundException.php:24
doxygen
typo3
sysext
core
Classes
Context
LanguageAspect.php
Generated on Tue Oct 5 2021 01:57:03 for TYPO3CMS by
1.8.18