Sicherheitslücke melden

Haben Sie eine mögliche Sicherheitslücke in diesem Produkt entdeckt? Auf unserer Sicherheitsseite finden Sie den zuständigen Kontakt und Hinweise dazu, welche Informationen Ihre Meldung enthalten sollte.

Sicherheitslücke melden

Table of Contents

  1. EXT: languagevisibility

EXT: languagevisibility

License: GNU GPL, Version 2

Repository: https://gitlab.sgalinski.de/typo3/languagevisibility

Configuration

Use this TypoScript code to set up your language behavior in the FE:

config.sys_language_mode = ignore
config.sys_language_overlay = 1

//normal language configuration:
config.sys_language_uid = 0
config.language = en
config.htmlTag_langKey = en
config.locale_all = en_GB.utf8

//deutsch
[globalVar = GP:L=1]
    config.sys_language_uid = 1
    config.language = de
    config.htmlTag_langKey = de
    config.locale_all = de_DE.utf8
[global]
...

Frontend visibility

Frontend visibility checks run before TYPO3 prepares the page for rendering. The middleware initializes the language context from the resolved site language, preserving its overlay and fallback settings. A page allowed in a translated language remains accessible when its default language is disabled; explicitly disabled languages continue to return HTTP 404.

Extbase lookups by an original record's UID support the translated visibility rule. The filter requires an accessible translation in the requested language before TYPO3 applies the overlay. Hidden, deleted, scheduled and unavailable workspace translations do not satisfy the rule. List retrieval and counts use the same translation check.

Backend visibility summaries

The Page module shows a language visibility banner for a page and a compact summary in a content preview only when the respective original record has an inactive or translated rule for an enabled site language. Default (active) settings and rules for disabled or unavailable languages do not produce a summary. Content summaries use the content element's own settings; page settings do not enable summaries for all content elements.

The summary lists visible and hidden languages and explains translation requirements. Authorized editors can open the corresponding visibility settings directly. Translated content links to its original record. Records without a site or an available original record do not show a summary.

Visibility controls share TYPO3's existing language tab with the standard language fields. Custom content types should leave registration of tx_languagevisibility_visibility to this extension instead of including it in their own showitem list before TYPO3 prepares the system tabs.

Use languagevisibility for own records

There are 3 steps to take:

  1. Extend your table with the required field and TCA
  2. Register your table to the languagevisibility core
  3. Use the correct code so that the desired functionality happened

1. Extend your table

Add this definition to your table TCA configuration:

'tx_languagevisibility_visibility' => [
	'exclude' => 1,
	'label' => 'LLL:EXT:languagevisibility/Resources/Private/Language/locallang_db.xlf:pages.tx_languagevisibility_visibility',
	'config' => [
		'type' => 'text',
		'renderType' => 'languageVisibility',
	]
];

The text type lets TYPO3 derive the required LONGTEXT database column from TCA. The custom languageVisibility render type continues to render the visibility controls.

2. Register your table

Use the existing registration Hook :

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['languagevisibility']['recordElementSupportedTables'][<table>]= [];

(this will handle your table like a default record element. If you need more control you can also register your own visibility element class)

Note

If you want to access the data directly with the Doctrine Querybuilder, you need to add the following code manually, if the languagevisibility matters:

if (FrontendServices::isSupportedTable($tableName)) {
    if (FrontendServices::checkVisiblityForElement($row, $tableName, $languageUid)) {
        return;
    }
}