I'm developing a plugin for Shopware 5.2. However, in my application, there are also legacy plugins from before the upgrade to version 5.2.
The documentation tells me to use a call like this in order to access another specific plugin from within my plugin:
$plugin = Shopware()->Container()->get('kernel')->getPlugins()['anotherPlugin'];
Unfortunately, this returns null
with legacy plugins, as the method getPlugins()
returns an array containing only the plugins written for version 5.2 (those residing in the custom/plugins
folder).
How can I deal with this issue?
For the legacy Versions you can retrieve the plugins from the container:
or with
Frontend
if it is a frontend Pluginor with
Core
if it is a Shopware Core Legacy Plugin.I will suggest you to migrate to the new structure, because this will not be supported for long (if not already with the 5.3).