I was looking for how to re-use my User module across other projects. As I have custom features for each my clients, I decided to create:
- One generic UserModule to be packaging
- One extend-module called UserCustom
UserModule has the following views: login and add (for register). UserCustom is extending Module.php and no more.
<?php
namespace UserCustom;
use Laminas\Mvc\MvcEvent;
use Users\Module as UserModule;
class Module extends UserModule
{
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
Now, imagine that I want to change ONLY login view to add a logo.
I do not understand how can I overwrite specific view files and keep the others. With my current config, I must to overwrite every view that UserModule has (overwrite to new file location or even vendor).
I've declared the following code to login new view file: UserCustom module.config.php:
'view_manager' => [
'template_map' => [
'user/login' => __DIR__ . '/../view/user-custom/new_login.phtml',
But, when I go to /add page, its seems like I need to declare every view. Laminas\View\Renderer\PhpRenderer::render: Unable to render template "user/add"; resolver could not resolve to a file
My UserModule has a
'template_path_stack' => [
'user' => __DIR__ . '/../view',
],
but I do not know if its helps me.
Thank you