Bug #48977
f:link.action ignores controller with backslashes
Status: | Closed | Start date: | 2013-06-10 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 0% |
|
Category: | ViewHelpers | |||
Target version: | - | |||
Has patch: | No | Affected Flow version: | (any) |
Description
I have a neos backend module and want to link to another controller. The controller is not straight under the controller folder but under Controller/Module/MyModule/.
I tried linking to MyController like that:
<f:link.action action="index" controller="Module\Module\MyController" class="btn neos-button">
but it just doesnt work.
I found an existing "example" for this:
<f:link.action package="TYPO3.Neos" controller="Backend\Backend" action="index">Content</f:link.action>
under \Packages\Application\TYPO3.Neos\Resources\Private\Templates\Backend\Content\Container.html
but that is also not working.
I don't know if this has ever worked or not so i don't know if its possible to trace it back to a working state.
History
#1 Updated by Bastian Waidelich about 2 years ago
- Status changed from New to Closed
- Assigned To set to Bastian Waidelich
Hi Simon,
as mentioned in the Hangout this is not actually a bug (If I'm not completely wrong).
The reason is that the backend modules are a bit "special" when it comes to MVC:
All module requests go to the Backend controller of Neos. The actual module to be called is encoded in the "module" argument as you can see from the Module routes:
1- 2 name: 'Backend - Modules' 3 uriPattern: 'neos/{module}' 4 defaults: 5 '@package': 'TYPO3.Neos' 6 '@controller': 'Backend\Module' 7 '@action': 'index' 8 '@format': 'html' 9 routeParts: 10 module: 11 handler: TYPO3\Neos\Routing\BackendModuleRoutePartHandler
So you're link should look something like:
1<f:link.action package="TYPO3.Neos" controller="Backend\Backend" action="index" additionalArguments="{module: 'yourmodulename', controller: '\Your\ModuleController', action: 'index'}" class="btn neos-button">Content</f:link.action>
But the "right" way to do this is to use the link.module ViewHelper provided by Neos:
1{namespace neos=TYPO3\Neos\ViewHelpers} 2<neos:link.module path="yourmodulename" class="btn neos-button">Cancel</neos:link.module>