[TYPO3-core] Dispatch extbase extension without registering it as module.
Alexander Stehlik
alexander.stehlik at gmail.com
Wed Oct 9 10:46:20 CEST 2013
Hi there,
I had this problem recently (I wanted to render a link browser tab using
an Extbase controller) and this is how I "hacked" it (maybe someone can
use it):
In ext_tables.php I first register a new Module:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule('Sto.' .
$_EXTKEY, 'tools', 'person_browser', '', array('Backend' =>
'personBrowser'));
Then I prevent it from appearing in the menu by removing it from the
TBE_MODULES configuration (also in ext_tables.php):
$list = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',
$GLOBALS['TBE_MODULES']['tools'], TRUE);
$list =
\TYPO3\CMS\Core\Utility\GeneralUtility::removeArrayEntryByValue($list,
'StoPersonlistPersonBrowser');
$GLOBALS['TBE_MODULES']['tools'] = implode(',', $list);
Finally I run the module in a seperate ouput buffer in the render() method:
// Re-add module to TBE_MODULES, otherwise it will not run
$toolsBackup = $GLOBALS['TBE_MODULES']['tools'];
$GLOBALS['TBE_MODULES']['tools'] .= ',StoPersonlistPersonBrowser';
ob_start();
$objectManager =
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$moduleRunner =
$objectManager->get('TYPO3\\CMS\\Extbase\\Core\\ModuleRunnerInterface');
$moduleRunner->callModule('tools_StoPersonlistPersonBrowser');
$result = ob_get_clean();
// After running the original configuration is restored
$GLOBALS['TBE_MODULES']['tools'] = $toolsBackup;
But the approach from the belog Extension seems to be a bit more elegant :)
Kind regards,
Alex
Am 04.10.2013 21:30, schrieb Christian Kuhn:
> On 10/04/2013 06:48 PM, Philipp Gampe wrote:
>> Hi all,
>>
>> I would like to find a proper way to call certain extbase actions from
>> the
>> backend without registering them as modules.
>> Background: http://forge.typo3.org/issues/52482 with the corresponding
>> change.
>>
>> I do not think that registering "hidden" modules is the right approach,
>
> +1. This is imho an extbase bootrap issue.
>
> ext:belog solves a similar issue with a (happily commented) hack in
> BackendLogModuleBootstrap class.
>
> Regards
> Christian
More information about the TYPO3-team-core
mailing list