3

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.

3
  • 1
    If you get an error like "Class does not exist." please also specify what class name it supposedly tried to look up. That way it's easier to find the error -- Since you're using TYPO3 10, where the way how controllers are registered changed, it might also require to use the changed syntax with the switchableControllerActions setup. i.e. using the full class name for the controller. Not tried though. -- Also note that TYPO3 10 LTS has not been released yet. It's still in development. Commented Jan 9, 2020 at 9:09
  • @Nitori Thanks again for your help. Classes are same as those in the other question. The problems seem to be related since they are solved the same way and follow the same deprecation notice stated in my recent question. I think it satisfies both adequately. Commented Jan 9, 2020 at 12:54
  • Change USER_INT to just USER for your first implementation Commented Jan 14, 2020 at 10:40

1 Answer 1

6

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,

  1. Create a new plugin entry in your ext_localconf.php for the controller and action you want.
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'yourExtension',
    'yourPlugin1',
    [
        'FooController' => 'list'
    ]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'yourExtension',
    'yourPlugin2',
    [
        'FooController' => 'show'
    ]
);
  1. Make sure the action you want is the first (default) one in the list. If you put more then one action in one plugin and you will try to execute any other then first from TypoScript it won't work.
  2. Reference that plugin in your TypoScript.

Hope it helps someone.

Anyone with a better solution is welcome to provide it or improve this one.

Sign up to request clarification or add additional context in comments.

2 Comments

You could add a ticket on forge.typo3.org because I suspect it was not intentional to remove the possibility to select an action.
Switchable Controller Actions are officially deprecated docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.3/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.