Project

General

Profile

Actions

Bug #88399

open

Controller action ignored when defined through Typoscript

Added by John Miller over 5 years ago. Updated almost 3 years ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-01-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
extbase TypoScript controller action
Complexity:
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by John Miller over 5 years ago

  • Description updated (diff)

Removed formating.

Actions #2

Updated by Josef Glatz over 5 years ago

  • Description updated (diff)
Actions #3

Updated by John Miller over 5 years ago

  • Tracker changed from Epic to Feature
  • Description updated (diff)
Actions #4

Updated by John Miller almost 5 years ago

  • Tracker changed from Feature to Bug
  • Subject changed from Controller/Action ignored when defined through Typoscript to Controller action ignored when defined through Typoscript
  • Category changed from TypoScript to Extbase
  • Start date changed from 2019-05-20 to 2020-01-08
  • TYPO3 Version set to 10
  • PHP Version set to 7.2
  • Tags set to extbase TypoScript controller action
Actions #5

Updated by Alexander Schnitzler almost 5 years ago

  • Status changed from New to Accepted

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.

Actions #6

Updated by Alexander Schnitzler almost 5 years ago

  • Is Regression set to No
Actions #7

Updated by S P almost 3 years ago

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.

Actions

Also available in: Atom PDF