KFO
KFO

Reputation: 338

Extending ZfcUsers UserController

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.

Upvotes: 0

Views: 1607

Answers (2)

m1k3lm
m1k3lm

Reputation: 66

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

Upvotes: 0

aufziehvogel
aufziehvogel

Reputation: 7287

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.

Upvotes: 1

Related Questions