I’ve a backend module for manipulating our Members.
A Member is just a user, that can log in.
It has a number of props and serves as the parent object for more specialized members: PersonalMember (natural persons) and CorporateMember (companies) extend Member.
This works fine, so far.
Now, I want to clean up the code:
At the beginning I had it all together in the MemberController (default routing -> neos/energieWinner/members).
The indexAction() renders the list of all members (All kinds). It should be the only action there.
When klicking on a line of that list, the respective actions should be handled by the specialized PersonalMemberController and the CorporateMemberController. They are in the some directory as the MemberController.
So, I enabled routes for my Package (Settings.yaml):
The issue here is that backend modules aren’t using the normal routing you find in Flow. If you do that and allow access to a backend module using custom routing, you’ll be bypassing the backend module logic including security and navigation.
Instead what you need to do is to register the other controllers as submodules of your main module and link using the <neos:module.link /> view helper which accepts a “path” argument along with normal arguments like you’re used to.
thank you for the information.
Unfortunately this module is already a subModule. It seems, that a subModule has to have a label.
I never saw a subModule definition with more than one Controller defined. Is this possible?
If the logic is: One Submodule -> One Controller, it would be OK for me.
This Controller grows a little bit fatter than normally, because it has to work on 3 Domain Models.
All modules can have submodules, even modules already defined as submodules. There’s no difference except the menu hierarchy. One advantage that it already is a submodule is that it’s submodules wouldn’t be shown in the module menu as it only shows the top two levels.
And no one module equals one controller. Regardless this shouldn’t be an issue for you.
Management module (/neos/management/) – visible in module menu
…Sub module A (/neos/management/a/) > Controller A – visible in module menu
…Sub module A1 (/neos/management/a/a1) > Controller A1 – not visible in module menu
…Sub module A2 (/neos/management/a/a2) > Controller A2 – not visible in module menu
Then use path=“management/a/a1” to link to A1 from A or A2.
Can’t foreward() - or - redirect() to an other module controller.
From the Settings, Templates and ViewHelper I’ve got it running:
The MemberController (parent) only has the indexAction(), nothing more.
In the index.html I use:
I did 20 Variations of this lines, but can’t get it to work.
What’s the magic spell here?
Neos allways try to use (error message) PersonalMember/Index.html, but never Member/Index.html.
I understand it’s difficult, and there is certainly a magic spell needed here. Unfortunately the module concept is not really polished, so there’s no helper classes to achieve this yet.
Also as a bonus, if you want to have your module on the top level (next to management and administration), but don’t the submodules to appear in the menu, there’s a hideInMenu option you can set on the submodules to hide them.