Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7662571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:50:05+00:00 2026-05-31T13:50:05+00:00

How should I apply custom styles to Vendor Module’s Form or embed it on

  • 0

How should I apply custom styles to Vendor Module’s Form or embed it on my own View script?
More specifically I want to work with forms provided by EdpUser Module (https://github.com/EvanDotPro/EdpUser).

The easiest way seems to be modifying the vendor’s script directly. But obviously this will conflict with vendor’s future updates.

Another way seems to be copying Vendor’s Controller into my own Module then provide my own views. However this suffers a similar issue of getting out of sync with Vendor’s future updates. And I will have to be careful with namespace.

Maybe I should extend Vendor’s Controller instead of copying it. This should work well with namespaces and I should be able to access the Forms within my Controller quite easily. While using my own view scripts. Is this the right way or is there a better one?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:50:06+00:00Added an answer on May 31, 2026 at 1:50 pm

    It is not the recommended approach to modify anything in the module’s directory, especially those modules put in /vendor/. This is also the reason configuration templates must be copied to your own /config/autoload/ directory.

    A module must provide sufficient extension points to make it flexible enough for your usage. Among those possibilities are the following options:

    Change a route

    The ZfcUser module registers itself under the /user url. If you want to change that into /account for example, you can simply add this to your configuration:

    <?php
    return array(
        'di' => array(
            'instance' => array(
                'Zend\Mvc\Router\RouteStack' => array(
                    'parameters' => array(
                        'routes' => array(
                            'zfcuser' => array(
                                'options' => array(
                                    'route' => '/account',
                                ),
                            ),
                        ),
                    ),
                ),
            ),
        ),
    );
    

    Change a controller

    If you are not happy the ZfcUser\Controller\UserController is used and you want to override some action in this controller, you can create a custom controller, for example MyUser\Controller\UserController. If you extend the ZfcUser\Controller\UserController and provide this configuration, you are ready to go:

    <?php
    return array(
        'di' => array(
            'instance' => array(
                'Zend\Mvc\Router\RouteStack' => array(
                    'parameters' => array(
                        'routes' => array(
                            'zfcuser' => array(
                                'options' => array(
                                    'defaults' => array(
                                        'controller' => 'MyUser\Controller\UserController'
                                    ),
                                ),
                            ),
                        ),
                    ),
                ),
            ),
        ),
    );
    

    You can also use DI aliasing to override the zfcuser alias in your DI configuration:

    <?php
    return array(
        'di' => array(
            'instance' => array(
                'alias' => array(
                    'zfcuser' => 'MyUser\Controller\UserController'
                ),
            ),
        ),
    );
    

    Modify the form instance

    For example the ZfcUser module triggers several events to help other modules hook into the form creation process. Both the ZfcUser\Form\Login as ZfcUser\Form\Register trigger an init event after they set up all form elements. This gives you the chance to add or remove elements.

    use Zend\EventManager\StaticEventManager;
    
    $events = StaticEventManager::getInstance();
    $events->attach('ZfcUser\Form\Login', 'init', function ($e) {
      $form = $e->getTarget();
      $form->addElement('text', 'something-new');
    });
    

    I need to make two remarks here:

    1. Every module must provide its own triggers. This ZfcUser has the init on both forms, but this is not a given for every module. You must look into the documentation or source code to find out about this.
    2. The Zend\EventManager is currently under a refactoring to replace the singleton StaticEventManager by a SharedEventManager instance which can be instantiated through the Zend\Di locator. You can watch the progress of this refactoring in this Pull Request.

    Change a view or form rendering

    As per this RFC the Zend\Form component is likely to change. Especially for the rendering, the decorators will be removed and “just” normal view helpers will render the form instead. With this given, plus the possibility to override views, it is very easy to change the rendering of an action just by using another module with only some view scripts.

    If you create your own module and provide this configuration, you add a new location to the template path stack:

    <?php
    return array(
        'di' => array(
            'instance' => array(
                'Zend\View\Resolver\TemplatePathStack' => array(
                    'parameters' => array(
                        'paths' => array(
                            'myuser' => __DIR__ . '/../view',
                        ),
                    ),
                ),
            ),
        ),
    );
    

    Now you can create view scripts in your module’s view directory. If you have your module called “MyUser” and located under /modules/MyUser and you want to override the login view script from ZfcUser (located in /vendor/ZfcUser/view/zfcuser/login.phtml, create your view script in /modules/MyUser/view/zfcuser/login.phtml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is in the context of a Dojo editor, but it should apply more
I want to add a custom table to my iPhone app, that should look
I want to specify that my output rule should only apply to the contents
I want to provide a custom view in the admin very similar to changelist_view()
This question is specifically for .net CF, but it should apply to any slow,
Example: I have two shared objects (same should apply to .dlls). The first shared
Now this is .NET but I am sure the principal should apply to all
The precedence section in chapter 9.3.1 tells me that I should apply the special
This particular example relates to Django in Python, but should apply to any language
I came across this question on transcender: What should you apply to a field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.