我正在尝试使用TYPO3 10.x创建后端模块组。该模块在现有的模块组(例如“ Web”模块)下运行良好。
我正在尝试添加自己的模块组,这是我的代码:
ext_tables.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
'CEBuilder',
'cebuilder',
'top',
[
\Dev\CEBuilder\Controller\ContentElemetController::class => 'list',
],
[
'name' => 'CEBuilder',
'icon' => 'EXT:cebuilder/Resources/Public/Icons/Extension.svg',
'labels' => [
'll_ref' => 'LLL:EXT:cebuilder/Resources/Private/Language/locallang_mod.xlf'
]
]
);
我找到了一些解决方案,并在下面的代码中添加了
if (!isset($GLOBALS['TBE_MODULES']['cebuilder'])) {
$temp_TBE_MODULES = [];
foreach ($GLOBALS['TBE_MODULES'] as $key => $val) {
if ($key == 'web') {
$temp_TBE_MODULES[$key] = $val;
$temp_TBE_MODULES['cebuilder'] = '';
} else {
$temp_TBE_MODULES[$key] = $val;
}
}
$GLOBALS['TBE_MODULES'] = $temp_TBE_MODULES;
$GLOBALS['TBE_MODULES']['_configuration']['cebuilder'] = [
'labels' => 'LLL:EXT:cebuilder/Resources/Private/Language/locallang_mod.xlf',
'name' => 'cebuilder',
'iconIdentifier' => 'module-cebuilder'
];
}
它可以在以前的版本中使用,而在TYPO3版本7或8中则更早。但是,以某种方式,它不能与TYPO3 10.x一起使用
这是我的locallang文件
locallang_mod.xlf
<trans-unit id="mlang_tabs_tab" xml:space="preserve">
<source>Company Tools</source>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr" xml:space="preserve">
<source>Description used for about screen, what does the extension do?</source>
</trans-unit>
<trans-unit id="mlang_labels_tablabel" xml:space="preserve">
<source>Company Tools</source>
</trans-unit>