Typo3:在typo3后端模块列表中将不同扩展的模块放在一个模块组中

Typo3: Put modules of different extensions in one Module group in the typo3 backend module list

目前我正在尝试在左侧的 typo3 后端模块列表中创建一个模块组。我的小组对同一扩展中的模块工作正常。但是当我尝试从其他扩展中添加模块时,它根本不起作用。

我在我的其他扩展之一的 ext_tables.php 文件中创建了这个模块组 (mainmodule),如下所示:

/** * Creates a Backend Module Category */ $GLOBALS['TBE_MODULES'] = array_slice($GLOBALS['TBE_MODULES'], 0, 1, true) + ['mainmodule' => ''] + array_slice($GLOBALS['TBE_MODULES'], 1, count($GLOBALS['TBE_MODULES']) - 1, true); $GLOBALS['TBE_MODULES']['_configuration']['mainmodule'] = [ 'iconIdentifier' => 'module', 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_myExt.xlf:mlang_key', 'name' => 'mainmodule', ];

我正尝试在不同的扩展中使用主模块,如下所示:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( 'VEN.' . $extKey, 'mainmodule', // Make module a submodule of 'mainmodule' 'randomkey', // Submodule key '', ... 该模块始终在其 "own" 主模块内创建。

我已经尝试了此处在 Whosebug 上提供的所有解决方案,并花了数小时尝试解决此问题。我只是无法让它工作..

似乎在定义新后端模块类别的扩展之前加载了其他扩展。所以 \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule 会因为缺少类别而失败。要检查这一点,请查看 typo3conf/PackageStates.php.

中扩展的加载顺序

要解决此问题,请将此扩展添加到 ext_em.conf 中的 constraintcomposer.json 中的 require 以强制它在依赖于的其他扩展之前加载新的后端模块类别。参见 https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/DeclarationFile/Index.html and https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ExtensionArchitecture/ComposerJson/Index.html

其他解决方案可能是在每个扩展中添加新类别(如果尚不存在)。