Question

i want to extend the UserController with an setEventManager implementation, to display another layout - just with an login mask.

When i call the url www.example.com i get my Controller, with the other layout. But if type in a wrong username, i redirected to www.exmpale.com/user/login and i get the default layout.

How i can overwrite all routes from ZfcUser Module and redirect them to my own controller, to ensure, the UserController can not called directly.

Thank you.

Was it helpful?

Solution

If I understand your question right, you probably just have to edit the file module.config.php. It contains all route definitions.

From how I understand your question you have an own controller called something like MyBetterUserController?

You can add an own module as extension to the ZfcUser module, maybe you want to call it something like ZfcUserMod. This new module will only contain a Module.php file and a folder config with the configuration file.

Then you can define your routes in this module’s configuration file and overwrite all routes from ZfcUser. Make sure that you use the exactly same route names (the keys in the array) as ZfcUser does (currently they use zfcuser as route name). Otherwise the routes will not be overwriten and the UrlHelper will not use your routes.

Then add ZfcUserMod to the global application.config.php after ZfcUser.

OTHER TIPS

Wouldn't it be easier to override just the controllers -> invocables pointing 'zfcuser' => 'namespace\your\extendedusercontroller' instead of rewriting all the routes ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top