How do I bootstrap a plugin on TYPO3 CMS 6.0 with

2020-02-09 04:18发布

I'm trying to use an extbase plugin through typoscript on TYPO3 CMS 6.0. I used the following code, that I found repeated all over the web:

10 = USER
10 { 
    userFunc = tx_extbase_core_bootstrap->run
    pluginName = Sermons
    extensionName = VmfdsSermons
    switchableControllerActions {
        Sermon {
            1 = byLatestSeries
            2 = list
            3 = show
    }
}

However, this just gives me the following error:

#1289386765: Could not analyse class:Tx_VmfdsSermons_Controller_SermonController maybe not loaded or no autoloader?

It seems to me as if tx_extbase_core_bootstrap->run is not using namespaces yet, thus trying to load a class called Tx_VmfdsSermons_Controller_SermonController when it should have called \TYPO3\VmfdsSermons\Controller\SermonController. Is there a way around this?

2条回答
仙女界的扛把子
2楼-- · 2020-02-09 05:07

You're searching for the property vendorName. So in your case it should be:

10 = USER
10 { 
    userFunc      = TYPO3\CMS\Extbase\Core\Bootstrap->run

    pluginName    = Sermons
    extensionName = VmfdsSermons
    vendorName    = TYPO3
    [...]

I also used the vendor namespace within ext_localconf.php:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    '<Vendor>.' . $_EXTKEY, 
    [...]

I found the answer by using the debugger. I started at \TYPO3\CMS\Extbase\Mvc\Dispatcher::resolveController() and jumped into TYPO3\CMS\Extbase\Mvc\Request::getControllerObjectName(). There is a member controllerVendorName, so I searched in Extbase for the setter of \TYPO3\CMS\Extbase\Mvc\Request::setControllerVendorName(), precisely just for setControllerVendorName, and got a match in \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::build(), where is a member called vendorName, and just in the method above \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::loadDefaultValues(), is the answer!

查看更多
Rolldiameter
3楼-- · 2020-02-09 05:14

Calling tx_extbase_core_bootstrap should no longer be used as it is deprecated in ver. 6.0 and will be removed in 7.0

You can try different. Developers should now handle everything with namespaces ...

You can use this:

# bootstrap aufrufen -> run from extbase

userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
查看更多
登录 后发表回答