Search code examples
zend-framework2zfcuser

ZF2 - ZfcUser unable to change view scripts


I'm very new to Zend Framework. I can't manage to override the view scripts of the ZfcUser module. I downloaded ZfcUser into the vendor directory. And I made the custom module and changed the routing. However, no luck changing the viewscripts.

I changed the url to profile instead of user. And made these configurations to include the override of the view scripts. However I am still getting the default scripts from the vendors folder. Would truly appreciate your help.

<?php

namespace Profile;

use Zend\Mvc\MvcEvent;

class Module
{

    public function getConfig()
    {
        return array (
            'router' => array (
                'routes' => array (
                    'zfcuser' => array (
                        'options' => array (
                            'route' => '/profile',
                        ),
                    ),
                ),
            ),
            'view_manager' => array(
                'template_path_stack' => array(
                    'profile' => __DIR__ . '/../view',
                ),
            ),
        );      
    }
}

And here's an image of the directory

directory of the modules folder


Solution

  • Ok here's how I got it fixed.. seems like it's nowhere in the documentation but it worked. I changed the view manager to look like this:

    'zfcuser' => __DIR__ . '/view',
    

    instead of

    'profile' => __DIR__ . '/../view',
    

    The only issue is that all the view scripts have to be imported in the custom module and overridden. Here's the results from the Module.php file in the custom module.

    <?php
    
    namespace Profile;
    
    use Zend\Mvc\MvcEvent;
    
    class Module
    {
    
        public function getConfig()
        {
            return array (
                'router' => array (
                    'routes' => array (
                        'zfcuser' => array (
                            'options' => array (
                                'route' => '/profile',
                            ),
                        ),
                    ),
                ),
                'view_manager' => array(
                    'template_path_stack' => array(
                        'zfcuser' => __DIR__ . '/view',
                    ),
                ),
            );      
        }
    }