I have an extension that has some config fields in the payment
section. The extension does not supply a payment method, I just want to have the settings in the Payment Methods section.
module.xml
:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Example_MyExtension" setup_version="0.1">
</module>
</config>
The system.xml
looks like this:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="payment">
<group id="myextension" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="1">
<label>MyExtension</label>
<field id="activate_export" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Export Orders</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
</section>
</system>
</config>
So everything's fine until now. Now I want to have a default value, so I create config.xml
.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
<myextension>
<activate_export>1</activate_export>
</myextension>
</payment>
</default>
</config>
When I try to open the configuration, I see nothing and get the following error in system.log
:
Payment model name is not provided in config!
The error is thrown in /vendor/magento/module-payment/Helper/Data.php
in getMethodInstance()
. As far as I can tell, the code tries to load a payment method named myextension
and fails.
When I place the configuration under section sales
, everything works as expected.
Questions:
- Is this a bug?
- If not, is it not only allowed to put configuration for payment modules in
payment
?