![]() Let’s write a module that will change user redirection, after successfully sending mail through the contact form. That prevents the other around methods from firing. What’s important to mention is that you can actually stop the plugin propagation in an around interceptor. It determines whether your plugin is run before other plugins intercepting the same method or after them. One of the config parameters you have to provide when registering your interceptor is sortOrder. Run both before and after the original method Let you modify the parameters that will be used The fight between modules for rewriting core functions is now a thing of the dark and cold past. Instead of extending a class and overloading some methods, we can just create a class, write a method and use it to modify the original one! We can also configure the order in which the plugins will be executed. ![]() ![]() Ok, so what are the said interceptors? Well… They intercept selected public methods and modify them. ![]() That’s how modules are called in WordPress development. In my opinion, calling this feature a “plugin” is a bit unfortunate, as it can be mistaken for “module”. Taking into account that Magento team wants developers to go by ‘composition over inheritance’ principle means that every developer should become familiar with plugins. Plugins are one of the new concepts in Magento world – they were introduced in Magento2 and are here to stay. ![]()
0 Comments
Leave a Reply. |