‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Context\LanguageAspect Class Reference
Inheritance diagram for TYPO3\CMS\Core\Context\LanguageAspect:
TYPO3\CMS\Core\Context\AspectInterface

Public Member Functions

 __construct (int $id=0, int $contentId=null, string $overlayType=self::OVERLAYS_ON_WITH_FLOATING, array $fallbackChain=[])
 
 getOverlayType ()
 
 getId ()
 
 getContentId ()
 
 getFallbackChain ()
 
 doOverlays ()
 
 getLegacyLanguageMode ()
 
 getLegacyOverlayType ()
 
int string array get (string $name)
 

Public Attributes

const OVERLAYS_OFF = 'off'
 
const OVERLAYS_MIXED = 'mixed'
 
const OVERLAYS_ON = 'on'
 
const OVERLAYS_ON_WITH_FLOATING = 'includeFloating'
 

Protected Attributes

int $id = 0
 
int $contentId = 0
 
array $fallbackChain = array( )
 
string $overlayType
 

Detailed Description

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

Definition at line 56 of file LanguageAspect.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Context\LanguageAspect::__construct ( int  $id = 0,
int  $contentId = null,
string  $overlayType = self::OVERLAYS_ON_WITH_FLOATING,
array  $fallbackChain = [] 
)

Member Function Documentation

◆ doOverlays()

TYPO3\CMS\Core\Context\LanguageAspect::doOverlays ( )

Whether overlays should be done

Definition at line 126 of file LanguageAspect.php.

References TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_OFF.

◆ get()

◆ getContentId()

TYPO3\CMS\Core\Context\LanguageAspect::getContentId ( )

Contains the language UID of the content records that should be overlaid to would be fetched. This is especially useful when a page requested with language=4 should fall back to showing content of language=2 (see fallbackChain)

Definition at line 113 of file LanguageAspect.php.

References TYPO3\CMS\Core\Context\LanguageAspect\$contentId.

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getRecordOverlay().

◆ getFallbackChain()

◆ getId()

TYPO3\CMS\Core\Context\LanguageAspect::getId ( )

◆ getLegacyLanguageMode()

TYPO3\CMS\Core\Context\LanguageAspect::getLegacyLanguageMode ( )

Previously known as TSFE->sys_language_mode, here for compatibility reasons

Definition at line 134 of file LanguageAspect.php.

Referenced by TYPO3\CMS\Core\Context\LanguageAspect\get().

◆ getLegacyOverlayType()

TYPO3\CMS\Core\Context\LanguageAspect::getLegacyOverlayType ( )

◆ getOverlayType()

TYPO3\CMS\Core\Context\LanguageAspect::getOverlayType ( )

Member Data Documentation

◆ $contentId

int TYPO3\CMS\Core\Context\LanguageAspect::$contentId = 0
protected

◆ $fallbackChain

array TYPO3\CMS\Core\Context\LanguageAspect::$fallbackChain = array( )
protected

◆ $id

int TYPO3\CMS\Core\Context\LanguageAspect::$id = 0
protected

◆ $overlayType

string TYPO3\CMS\Core\Context\LanguageAspect::$overlayType
protected

◆ OVERLAYS_MIXED

const TYPO3\CMS\Core\Context\LanguageAspect::OVERLAYS_MIXED = 'mixed'

Definition at line 75 of file LanguageAspect.php.

Referenced by TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Storage\Typo3DbQueryParserTest\addGetLanguageStatementWorksForForeignLanguageWithSubselectionTakesDeleteStatementIntoAccountIfNecessary(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Storage\Typo3DbQueryParserTest\addGetLanguageStatementWorksInBackendContextWithSubselectionTakesDeleteStatementIntoAccountIfNecessary(), TYPO3\CMS\Core\Context\LanguageAspectFactory\createFromSiteLanguage(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingHiddenPostsReturnsHiddenOverlayOverlayEnabled(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingPostsByInClauseReturnsDefaultPostsWithFallback(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageOverlay(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getLanguageStatement(), TYPO3\CMS\Core\Context\LanguageAspect\getLegacyOverlayType(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\queryFirst5PostsDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\queryPostsByPropertyDataProvider(), and TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Menu\AbstractMenuContentObjectTest\sectionIndexReturnsOverlaidRowBasedOnTheLanguageOfTheGivenPage().

◆ OVERLAYS_OFF

const TYPO3\CMS\Core\Context\LanguageAspect::OVERLAYS_OFF = 'off'

Definition at line 74 of file LanguageAspect.php.

Referenced by TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\countReturnsCorrectNumberOfPosts(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\countReturnsCorrectNumberOfPostsInEnglishLanguage(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\countReturnsCorrectNumberOfPostsInGreekLanguage(), TYPO3\CMS\Core\Context\LanguageAspectFactory\createFromSiteLanguage(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\customFindByUidOverlayDisabled(), TYPO3\CMS\Core\Context\LanguageAspect\doOverlays(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingHiddenPostsReturnsHiddenOverlay(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingPostByTagName(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingPostsReturnsGreekPostsWithFallback(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingTranslatedPostByBlogTitle(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingTranslatedPostByTagName(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingTranslatedPostByTitle(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\findByUidNoOverlaysDefaultLanguage(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\findByUidNoOverlaysLanguage(), TYPO3\CMS\Core\Tests\Unit\Utility\RootlineUtilityTest\getCacheIdentifierContainsAllContextParameters(), TYPO3\CMS\Core\Tests\Unit\Utility\RootlineUtilityTest\getCacheIdentifierReturnsValidIdentifierWithCommasInMountPointParameter(), TYPO3\CMS\Core\Context\LanguageAspect\getLegacyOverlayType(), TYPO3\CMS\Extbase\Persistence\Generic\Backend\getObjectByIdentifier(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRecordOverlay(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Storage\Typo3DbQueryParserTest\languageStatementWorksForNonDefaultLanguage(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Storage\Typo3DbQueryParserTest\languageStatementWorksInBackendContext(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\ParentChildTranslationTest\localizesChildrenOfAllLanguageElementToTranslation(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\orderingByBlogTitle(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\orderingByTitleRespectsEnglishTitles(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\postsWithoutRespectingSysLanguageDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\queryFirst5PostsDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\queryPostsByPropertyDataProvider(), and TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\setUp().

◆ OVERLAYS_ON

const TYPO3\CMS\Core\Context\LanguageAspect::OVERLAYS_ON = 'on'

Definition at line 76 of file LanguageAspect.php.

Referenced by TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\ControllerArgumentsMappingTest\actionGetsBlogFromUidArgument(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\customFindByUidOverlayEnabled(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingHiddenPostsWithIgnoreEnableField(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingPostsReturnsEnglishPostsWithFallback(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingPostsReturnsGreekPostsWithHideNonTranslated(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingTranslatedPostByEqualsUidClauseWithStrictLanguageSettings(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\TranslationTest\fetchingTranslatedPostByInClauseWithStrictLanguageSettings(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\findByUidOverlayModeOnDefaultLanguage(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\findByUidOverlayModeOnLanguage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageOverlay(), TYPO3\CMS\Core\Context\LanguageAspect\getLegacyOverlayType(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRecordOverlay(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\postsWithoutRespectingSysLanguageDataProvider(), TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\queryFirst5PostsDataProvider(), and TYPO3\CMS\Extbase\Tests\Functional\Persistence\QueryLocalizedDataTest\queryPostsByPropertyDataProvider().

◆ OVERLAYS_ON_WITH_FLOATING