LM-Commons / LmcUser

A generic user registration and authentication module for Laminas. Supports Laminas\Db and Doctrine2. (Formerly ZfcUser)
BSD 3-Clause "New" or "Revised" License
15 stars 16 forks source link

Use View template explicitly in controllers. Add templates to options #80

Open visto9259 opened 3 months ago

visto9259 commented 3 months ago

Currently, LmcUser uses a template stack in the View Manager configuration to map controller actions to templates. Most users will replace the provided templates to suit their UI needs. To overwrite the default templates, the use will overwrite the template map to have the View Manager use their templates.

For example, to overwrite the login template, the use will overwrite the lmc-user/user/login to point to their template file.

To make customization easier, the controller action should use named template and the named template should be in the Module Options.

For example, the login template to use should be defined by:

  'lmcuser => [
     'templates' => [
          'login' => 'lmc-user/user/login',
          /* ... */
      ],
  ],

Then, in the login action, the controller will retrieve the login template from the Module Options and set the template for the View Model instead of relying on the View Manager to inject the template.