[Neos] routes yaml config for neos backend module

Simon Schaufelberger (Schaufi) simonschaufi at guugelmail.de
Mon Jun 10 17:03:27 CEST 2013


> May I ask why you want to to this?

1. to learn it and understand how it works
2. to have nice urls ;)

 > This is not possible unfortunately as you can't alter query arguments
 > via routing currently.

ok.

i added the last block to my own Routes.yaml but its not working. i 
played with it, changed things to Uppercase for the first letter 
('@controller': 'module\administration\users'), added "@" to controller 
and so on but still no success. the links are still the ugly ones here:

http://dev.neos.local/neos/administration/users

for the "view" link.

is the 'module' block needed?

my code looks like this:

-
   name: 'Backend - User administration module'
   uriPattern: 'neos/administration/users/show/{moduleArguments.account}'
   defaults:
     '@package':    'TYPO3.Neos'
     '@controller': 'Backend\Module'
     '@action': 'index'
     'moduleArguments':
       '@package':    'TYPO3.Neos'
       '@subpackage': ''
       '@controller': 'Module\Administration\UsersController'
   routeParts:
     'moduleArguments.account':
       objectType: 'TYPO3\Flow\Security\Account'
       uriPattern: '{accountIdentifier}'

Regards, Schaufi

Am 10.06.2013 12:48, schrieb Bastian Waidelich:
> 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 ;)
>
>


More information about the Neos mailing list