magento2: Inconsistent location for plugins
I have noticed in app/code/Magento/CatalogUrlRewrite the location where Plugins are kept is inconsistent between Blocks & Models.
So in the code below (from app/code/Magento/CatalogUrlRewrite/etc/adminhtml/di.xml) shows Plugins for Models stored in the Model directory, but then Blocks and Controller Plugins are kept in a Plugins directory within the root of the module.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
...
<type name="Magento\UrlRewrite\Model\StorageInterface">
<plugin name="storage_plugin" type="Magento\CatalogUrlRewrite\Model\Category\Plugin\Storage"/>
</type>
<type name="Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes">
<plugin name="category_form_url_key_plugin" type="Magento\CatalogUrlRewrite\Plugin\Catalog\Block\Adminhtml\Category\Tab\Attributes"/>
</type>
...
<type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper">
<plugin name="product_save_rewrites_history_plugin" type="Magento\CatalogUrlRewrite\Plugin\Catalog\Controller\Adminhtml\Product\Initialization\Helper"/>
</type>
</config>
Is there a reason behind this? Was it intentional?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 22 (14 by maintainers)
Commits related to this issue
- [#2291]:+ fixed inconsistent plugin placement, removed duplicate plugins in adminhtml di which were already present in etc/di — committed to StevenGuapaBV/magento2 by StevenGuapaBV 6 years ago
- [#2291]:+ fixed test for changed plugins — committed to StevenGuapaBV/magento2 by StevenGuapaBV 6 years ago
- [#2291]:+ Fixed the errors in the test. Moved the Model plugins from the Catalog folder. — committed to StevenGuapaBV/magento2 by StevenGuapaBV 6 years ago
- [#2291]:+ fixed inconsistent plugin placement. Moved all the plugins to have Plugins folder as root. — committed to magento/magento2 by StevenGuapaBV 6 years ago
- [#2291]:+ removed duplicate plugins, already present in etc/di.xml — committed to magento/magento2 by StevenGuapaBV 6 years ago
- [#2291]:+ Fixed inconsistent plugin placement, Moved all the plugins to Plugin as root. Removed duplicate di plugin references. — committed to StevenGuapaBV/magento2 by StevenGuapaBV 6 years ago
This is an inconsistency in the core which needs to be addressed. The proper location per documentation is in
<module>/Plugin/source: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html#plugin-declare