LanguageAspect

final readonly class \TYPO3\CMS\Core\Context\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)

  • the requested language of the current page (frontend)
  • used in menus and links to generate "links in language with this ID"

"contentId" (int)

  • the language of records to be fetched
  • if empty, "languageId" is used.

"fallbackChain"

  • when "fallback" go with
  • depends on what "contentId" value should be set
  • defined in config.sys_language_mode (strict/content_fallback:4,5,stop/ignore?)
  • 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
  • usually you fetch language 0 and -1, then take the "contentId" and "overlay" them
    • here you have two choices 1. "on" (deprecated) - same as "includeFloating", but without records that have no default language counterpart 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" - if there is no overlay, do not render the default language records ("hideNonTranslated"), but include records of the "contentId" without default language counterpart (includeRecordsWithoutDefaultTranslation)

Table of Contents

Interfaces

AspectInterface
Interface AspectInterface Think of an aspect like a property bag

Constants

OVERLAYS_MIXED  : string = 'mixed'
OVERLAYS_OFF  : string = 'off'
OVERLAYS_ON  : string = 'on'
OVERLAYS_ON_WITH_FLOATING  : string = 'includeFloating'

Methods

__construct()  : mixed
Create the default language
doOverlays()  : bool
Whether overlays should be done
get()  : mixed
Fetch a property.
getContentId()  : int
Contains the language UID of the content records that should be overlaid to would be fetched.
getFallbackChain()  : array
getId()  : int
Returns the language ID the current page was requested, this is relevant when building menus or links to other pages.
getLegacyLanguageMode()  : string
Here for compatibility reasons
getLegacyOverlayType()  : string
Here for compatibility reasons
getOverlayType()  : string
Used language overlay

Constants

OVERLAYS_MIXED

public string OVERLAYS_MIXED = 'mixed'

OVERLAYS_OFF

public string OVERLAYS_OFF = 'off'

OVERLAYS_ON

Deprecated

since v15, will be removed in v16. Use OVERLAYS_ON_WITH_FLOATING instead.

public string OVERLAYS_ON = 'on'

OVERLAYS_ON_WITH_FLOATING

public string OVERLAYS_ON_WITH_FLOATING = 'includeFloating'

Methods

__construct()

Create the default language

public __construct([int $id = LanguageMarker::DEFAULT_LANGUAGE ][, int|null $contentId = null ][, string $overlayType = self::OVERLAYS_ON_WITH_FLOATING ][, array $fallbackChain = [] ]) : mixed

Parameters

$id : int = LanguageMarker::DEFAULT_LANGUAGE
$contentId : int|null = null
$overlayType : string = self::OVERLAYS_ON_WITH_FLOATING
$fallbackChain : array = []

doOverlays()

Whether overlays should be done

public doOverlays() : bool

Return values

bool

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

int

getFallbackChain()

public getFallbackChain() : array

Return values

array

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

int

getLegacyLanguageMode()

Here for compatibility reasons

public getLegacyLanguageMode() : string

Deprecated

since v15, will be removed in v16. Use getFallbackChain() instead.

Return values

string

getLegacyOverlayType()

Here for compatibility reasons

public getLegacyOverlayType() : string

Deprecated

since v15, will be removed in v16. Use getOverlayType() instead.

Return values

string

getOverlayType()

Used language overlay

public getOverlayType() : string

Return values

string
On this page