You cannot extend a module. The Zend Framework II module approach offers great advantages but extendability is not one of them. You are at the mercy of the external module configuration file. Luckily useful modules have useful configs. The registration and authentication module Zfcuser is one of them. Say you want to customise the default login screen to your desire. Here is how to do to it.

Step one: in config\autoload\zfuser.global.php set the default login view template to one of your own:


'user_login_widget_view_template' => 'application/user/login.phtml',
'logout_redirect_route' => 'custom-login-page',

and redirect a logout back to the login screen.

Step two: in module\Application\config\module.config.php set a route


 'custom-login-page' => array(
                'type' => 'Literal',
                'options' => array(
                    'route' => '/do/login',
                    'defaults' => array(
                        '__NAMESPACE__' => 'Application\Controller',
                        'controller' => 'Login',
                        'action' => 'index',
                    ),
                ),
                'may_terminate' => true,
            ),

Step three: create a login controller and in module\Application\view\application\login\index.phtml do


echo $this->zfcUserLoginWidget();

Step four: create a custom view in application/user/login.phtml for a login page:



echo $this->formElementErrors($form->get('identity'));
echo $this->form->get('identity')->setAttribute('class', 'form-control'); 
echo $this->formLabel($form->get('identity'));
echo $this->formInput($form->get('identity'));

Advertisements