LanguageAspect implements AspectInterface
The Aspect is usually available as "language" property, and can be used to find out the "overlay"/data retrieval strategy.
"id" (languageId, int)
- formally known as $TSFE->sys_language_uid
- the requested language of the current page (frontend)
- used in menus and links to generate "links in language with this ID"
"contentId" (int)
- formally known as $TSFE->sys_language_content
- the language of records to be fetched
- if empty, "languageId" is used.
"fallbackChain"
- when "fallback" go with
- depends what "contentId" value should be set
- defined in config.sys_language_mode (strict/content_fallback:4,5,stop/ignore?)
- previously known as $TSFE->sys_language_mode
- defines "contentId" based on "if the current page is available in this language"
- "strict"
- "fallback" if current page is not available, check the "fallbackChain"
- "fallbackAndIgnore"
"overlayType"
- defines which way the records should be fetched from ($TSFE->sys_language_contentOL and config.sys_language_overlay)
- usually you fetch language 0 and -1, then take the "contentId" and "overlay" them
- here you have two choices 1. "on" if there is no overlay, do not render the default language records ("hideNonTranslated") 2. "mixed" - if there is no overlay, just keep the default language, possibility to have mixed languages - config.sys_language_overlay = 1 3. "off" - do not do overlay, only fetch records available in the current "contentId" (see above), and do not care about overlays or fallbacks - fallbacks could be an option here, actually that is placed on top 4. "includeFloating" - on + includeRecordsWithoutDefaultTranslation
Table of Contents
Interfaces
- AspectInterface
- Interface AspectInterface Think of an aspect like a property bag
Constants
- OVERLAYS_MIXED = 'mixed'
- OVERLAYS_OFF = 'off'
- OVERLAYS_ON = 'on'
- OVERLAYS_ON_WITH_FLOATING = 'includeFloating'
Properties
- $contentId : int
- $fallbackChain : array<string|int, mixed>
- $id : int
- $overlayType : string
Methods
- __construct() : mixed
- Create the default language
- doOverlays() : bool
- Whether overlays should be done
- get() : int|string|array<string|int, mixed>
- Fetch a property.
- getContentId() : int
- Contains the language UID of the content records that should be overlaid to would be fetched.
- getFallbackChain() : array<string|int, mixed>
- getId() : int
- Returns the language ID the current page was requested, this is relevant when building menus or links to other pages.
- getLegacyLanguageMode() : string
- Previously known as TSFE->sys_language_mode, here for compatibility reasons
- getLegacyOverlayType() : string
- Previously known as TSFE->sys_language_contentOL, here for compatibility reasons
- getOverlayType() : string
- Used language overlay
Constants
OVERLAYS_MIXED
public
mixed
OVERLAYS_MIXED
= 'mixed'
OVERLAYS_OFF
public
mixed
OVERLAYS_OFF
= 'off'
OVERLAYS_ON
public
mixed
OVERLAYS_ON
= 'on'
OVERLAYS_ON_WITH_FLOATING
public
mixed
OVERLAYS_ON_WITH_FLOATING
= 'includeFloating'
Properties
$contentId
protected
int
$contentId
= 0
$fallbackChain
protected
array<string|int, mixed>
$fallbackChain
= []
$id
protected
int
$id
= 0
$overlayType
protected
string
$overlayType
Methods
__construct()
Create the default language
public
__construct([int $id = 0 ][, int|null $contentId = null ][, string $overlayType = self::OVERLAYS_ON_WITH_FLOATING ][, array<string|int, mixed> $fallbackChain = [] ]) : mixed
Parameters
- $id : int = 0
- $contentId : int|null = null
- $overlayType : string = self::OVERLAYS_ON_WITH_FLOATING
- $fallbackChain : array<string|int, mixed> = []
doOverlays()
Whether overlays should be done
public
doOverlays() : bool
Return values
boolget()
Fetch a property.
public
get(string $name) : int|string|array<string|int, mixed>
Parameters
- $name : string
Tags
Return values
int|string|array<string|int, mixed>getContentId()
Contains the language UID of the content records that should be overlaid to would be fetched.
public
getContentId() : int
This is especially useful when a page requested with language=4 should fall back to showing content of language=2 (see fallbackChain)
Return values
intgetFallbackChain()
public
getFallbackChain() : array<string|int, mixed>
Return values
array<string|int, mixed>getId()
Returns the language ID the current page was requested, this is relevant when building menus or links to other pages.
public
getId() : int
Return values
intgetLegacyLanguageMode()
Previously known as TSFE->sys_language_mode, here for compatibility reasons
public
getLegacyLanguageMode() : string
Return values
stringgetLegacyOverlayType()
Previously known as TSFE->sys_language_contentOL, here for compatibility reasons
public
getLegacyOverlayType() : string
Return values
stringgetOverlayType()
Used language overlay
public
getOverlayType() : string