0
votes

Currently I'm trying to create a module group in the typo3 backend module list on the left hand side. My group works fine for modules within the same extension. But when I try to add modules from other extensions to it, it simply doesn't work.

I have created this Module group (mainmodule) in the ext_tables.php file in one of my other extensions like this:

/** * 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', ];

I'm trying to use the mainmodule in a different extension as follows:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( 'VEN.' . $extKey, 'mainmodule', // Make module a submodule of 'mainmodule' 'randomkey', // Submodule key '', ... The module is always created inside its "own" mainmodule.

I have tried all of the solutions given here on stackoverflow and spent hours of trying to solve this issue. I just can't get it to work..

1

1 Answers

1
votes

It seems other extensions are loaded before this extensions which defines the new backend module category. So \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule will fail because of the missing category. To check this have a look at the loading order of the extensions in typo3conf/PackageStates.php.

To resolve the issue, add this extension to the constraint in ext_em.conf and require in composer.json to force it's loaded before the other extensions with the dependency to the new backend module category. See 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.

Other solution could be adding the new category in each extension if it does not already exist.