#88399Controller action ignored when defined through Typoscript
Description
Having correctly configured extension in ext_localconf.php, controllers, actions and associated settings assigned via TypoScript are completely ignored during run.
Example;
In ext_localconf.php;
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
VendorName.ExtensionName,
PluginName,
[
'Frontend' => 'index',
'Account' => 'index,login,logout,register'
], [
'Account' => 'login,logout,register'
]);
Example ts setup;
page = PAGE
page {
...
10 = USER
10 {
...
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = VendorName
extensionName = ExtensionName
pluginName = PluginName
controller = Frontend
action = index
}
}
...
5 = USER_INT
5 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = VendorName
extensionName = ExtensionName
pluginName = PluginName
controller = Account
action = login
}
In this setup, userFunc is picked up together with vendorName, extensionName, and pluginName. The rest of the details are ignored.
I then went ‘under the hood’ to check what’s going on and found that TYPO3 9 processes controller and action configurations only if they come from GET/POST (ServerRequest) parameters. (See TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::build()) If no parameter is found, RequestBuilder simply picks up the first controller and first action available under configured plugin. (See TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::loadDefaultValues()).
Am I wrong, or is there something am missing or is this by design and how can one go about defining controller action via TypoScript?
Thanx.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 8
-
John Miller commented and changed description <span data-processor="relativetime" data-value="2019-05-20T14:00:51+00:00" > 05/20/19, 14:00 </span>
-
Josef Glatz changed description <span data-processor="relativetime" data-value="2019-05-20T16:29:34+00:00" > 05/20/19, 16:29 </span>
-
John Miller changed tracker
EpicFeature description <span data-processor="relativetime" data-value="2019-05-21T10:02:59+00:00" > 05/21/19, 10:02 </span> -
John Miller changed tracker
FeatureBug subjectController/Action ignored when defined through TyposcriptController action ignored when defined through Typoscript category start date TYPO3 Version 10 PHP Version 7.2 Tags extbase TypoScript controller action <span data-processor="relativetime" data-value="2020-01-08T16:47:58+00:00" > 01/08/20, 16:47 </span> -
Alexander Schnitzler commented and changed status
NewAccepted <span data-processor="relativetime" data-value="2020-01-15T20:02:50+00:00" > 01/15/20, 20:02 </span>I shortly checked it and your findings are right. The given action is only used if present as query argument.
The behaviour is the same in TYPO3 9.5, so I figure it has been like this for a while.From my experience I would say that this is a bug but not a regression.
-
Alexander Schnitzler changed Is Regression 0 <span data-processor="relativetime" data-value="2020-01-16T11:06:01+00:00" > 01/16/20, 11:06 </span>
-
S P commented <span data-processor="relativetime" data-value="2022-02-21T07:41:04+00:00" > 02/21/22, 07:41 </span>
The configuration key
actiondoes not exist. Where did you get this from? You have to configure your actions through theswitchableControllerActions. The first one will be loaded initially, all other can be requested through GET/POST parameters at runtime. The actions must be a subset of the complete action list from theext_localconf.phpfile.switchableControllerActions { YourController { 1 = yourDefaultAction 2 = thisActionCanBeCalled 3 = anotherAllowedAction } }NOTE: switchableControllerActions are deprecated in v10 (but still work in v11)! You have to use separate plugins starting with v12 anyways.
I think the issue can be closed as I can’t see a bug here. Maybe unclear documentation.
-
Benni Mack commented and changed status
AcceptedClosed <span data-processor="relativetime" data-value="2024-12-10T14:53:52+00:00" > 12/10/24, 14:53 </span>I agree with S P here, this isn’t really a Core issue, but more a documentation issue.
Removed formating.