[Neos] routes yaml config for neos backend module
Bastian Waidelich
bastian at typo3.org
Mon Jun 10 12:48:40 CEST 2013
Simon Schaufelberger (Schaufi) wrote:
Hi Simon,
> I want to create my own neos backen module routes but its just not working.
May I ask why you want to to this?
Though it should be possible in theory, this could lead to conflicts
with existing or coming "backend routes"
> Can somebody please send me an example for the following url:
> http://neos.local/neos/administration/users/show?moduleArguments%5Baccount%5D%5B__identity%5D=51c7d653-42de-7aaf-eeff-5b6df6a25117
>
> to make something like this:
> http://neos.local/neos/administration/users/show?account=username
This is not possible unfortunately as you can't alter query arguments
via routing currently.
> and/or:
>
> http://neos.local/neos/administration/users/username/show
This should work. But due to the somewhat "funky"
BackendModuleRoutePartHandler this is not really straight forward.
Here's how you can get there:
If you browse to the detail view
(http://neos.local/neos/administration/users/show?moduleArguments%5Baccount%5D%5B__identity%5D=51c7d653-42de-7aaf-eeff-5b6df6a25117)
the log should contain:
Router route(): Route "TYPO3Neos :: Backend - Modules" matched the path
"neos/administration/users/show".
Now copy the respective Route from TYPO3.Neos/Configuration/Routes.yaml
to the *top* of your applications Routes.yaml:
-
name: 'Backend - Modules'
uriPattern: 'neos/{module}'
defaults:
'@package': 'TYPO3.Neos'
'@controller': 'Backend\Module'
'@action': 'index'
'@format': 'html'
routeParts:
module:
handler: TYPO3\Neos\Routing\BackendModuleRoutePartHandler
If you then debug the BackendModuleRoutePartHandler::matchValue() method
you can see that it creates an array with the keys 'module',
'controller' & 'action' (This is the funky part about this as RoutePart
handlers usually just return strings).
As you already know the three values, you can replace the RoutePart
handler. Furthermore you need to add the "exceeding" argument
moduleArguments['account'] to your route:
-
name: 'Backend - User administration module'
uriPattern:
'neos/administration/users/{moduleArguments.account}/{moduleArguments. at action}'
defaults:
'@package': 'TYPO3.Neos'
'@controller': 'Backend\Module'
'@action': 'index'
'moduleArguments':
'@package': 'typo3.neos'
'@subpackage': ''
'@controller': 'module\administration\users'
'module':
'module': 'administration/users'
'controller':
'\TYPO3\Neos\Controller\Module\Administration\UsersController'
'action': 'index'
routeParts:
'moduleArguments.account':
objectType: 'TYPO3\Flow\Security\Account'
uriPattern: '{accountIdentifier}'
This should work. But – again – be warned about altering "backend" routes ;)
--
Bastian Waidelich
--
Core Developer Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the Neos
mailing list