sgalinski/languagevisibility

TYPO3中的扩展语言可见性处理

安装: 879

依赖: 0

建议者: 0

安全: 0

类型:typo3-cms-extension


README

许可: GNU GPL, 版本 2

仓库: https://gitlab.sgalinski.de/typo3/languagevisibility

配置

使用以下TypoScript代码在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]
...

为自有记录使用languagevisibility

需要进行3个步骤

  1. 扩展您的表以包含所需的字段和TCA
  2. 将您的表注册到languagevisibility核心
  3. 使用正确的代码以实现所需的功能

1. 扩展您的表

将此定义添加到您的表TCA配置中

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

并在ext_tables.sql中添加

tx_languagevisibility_visibility text NOT NULL

2. 注册您的表

使用现有的注册钩子

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

(这将像默认记录元素一样处理您的表。如果您需要更多控制,也可以注册自己的可见性元素类)

注意

如果您想直接使用Doctrine Querybuilder访问数据,并且语言可见性很重要,您需要手动添加以下代码

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