Reputation: 1235
What is best way to extend zend framework 2 modules.
For example I want to change register page view in zfcuser , I cloned zfcuser module from vendor to modules folder and changed view files but Zend Framework 2 uses vendor folder one, If I delete zfcuser folder in vendor it works ok but two modules at same time uses vendor version
Upvotes: 0
Views: 442
Reputation: 2420
If you only want to override template files just override the module.config.php
in your Modul directory.
'view_manager' => array(
'template_path_stack' => array(
'zfcuser' => __DIR__ . '/../view',
),
),
Within your view directory add a folder called zfc-user
and add a register.phtml
file. Within that template file feel free to change whatever you want, just keep in mind that you still have to keep the form action as it is.
Upvotes: 1
Reputation: 5095
You don't have to clone the module. You can just create a zfc-user/user folder in your own module's view folder. And then place your own register.phtml in that folder. Just make sure that ZfcUser is included before your own custom module and then your own custom view should be loaded.
Edit: this is a link to the official docs on this topic: ZfcUser custom view scripts
Upvotes: 5