Issue Bug Closed

#88399Controller action ignored when defined through Typoscript

John Miller 05/20/19, 13:59 updated 12/10/24, 14:53

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

  1. John Miller changed tracker Feature Bug subject Controller/Action ignored when defined through Typoscript Controller 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>

  2. Alexander Schnitzler commented and changed status New Accepted <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.

  3. 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 action does not exist. Where did you get this from? You have to configure your actions through the switchableControllerActions. 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 the ext_localconf.php file.

    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.

  4. Benni Mack commented and changed status Accepted Closed <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.