简体   繁体   中英

How to override controllers in Pimcore plugins

In one of my projects, i have a third party plugin installed. Plugins are, from my understanding, a regular module in the Zend Framework sense (framework version 1.12 in this case).

Is there a way override the controllers shipped with the plugin with my own implementation without changing the module itself? I was think of something like "Check for a controller from a certain namespace first; if it doesn't exist, fall back to the one from the module".

What i am ultimately trying to achieve is to extend the module in a "hidden" or transparent way, so that i do not have to change the default routing, and the application will still look and work the same from a users perspective.

If thats not possible, what is best practice to extend a Pimcore plugin or a Zend Module in general?

When overriding functions of an Plugin you should create your own Class and Extend the Plugin ones: https://www.pimcore.org/docs/latest/Extending_Pimcore/Parent_Class_for_Objects.html

If needed you may then use DI https://www.pimcore.org/docs/latest/Extending_Pimcore/Dependency_Injection.html to always instantiate your Overriding Class which could / should extend or use then back the origin class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM