Reputation: 717
This question has been asked and answered numerous times through blogs and other platforms on the internet. However, the solutions don't seem to work for TYPO3 version 10 (I think also for versions 7, 8 and 9).
I have a class SpaceController
with action shuttleAction
which are well registered and uncached in ext_localconf.php file.
Here's what I've tried:
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Navigator
pluginName = mission
vendorName = Orbit
switchableControllerActions {
Space{
1 = shuttle
}
}
}
I get the error;
(1/2) #1278450972 TYPO3\CMS\Extbase\Reflection\Exception\UnknownClassException
Class does not exist. Reflection failed.
The class, plugin, extension and vendor do exist and in fact am using them for other actions, which work. However, can't get to pick an action via typoscript from the class.
I've tried the same with other Controllers and actions but none seems to work with this method.
Am trying to execute an action via TypoScript. How do I call a Controller's action from TypoScript? Am using TYPO3 version 10. I believe methods for versions 8 or 9 can also work for version 10. I've tried the same with these versions to no avail.
The following method works, but picks the first (default) action.
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = Orbit
extensionName = Navigator
pluginName = mission
}
If I add controller
and action
, action
gets ignored in favor of default action
.
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = Orbit
extensionName = Navigator
pluginName = mission
controller = Space
action = shuttle
}
I would like to pick the specific action to execute.
Upvotes: 3
Views: 2280
Reputation: 717
After hours of searching and experiments, it is clear that it's not possible at the moment to select an action via TypoScript. However, there is a workaround.
For anyone looking for a solution to this problem,
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'yourExtension',
'yourPlugin1',
[
'FooController' => 'list'
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'yourExtension',
'yourPlugin2',
[
'FooController' => 'show'
]
);
Hope it helps someone.
Anyone with a better solution is welcome to provide it or improve this one.
Upvotes: 6