3

I've been trying to add a system.xml configuration file to a Magento 2 module but I'm getting this error:

Fatal error: Call to undefined method Magento\Config\Model\Config\Structure\Element\Field\Interceptor::shouldCloneFields() in /Users/mludd/Sites/magento2.pippin.pantburk/vendor/magento/module-config/Model/Config.php on line 211

From what I can tell the method shouldCloneFields() does in fact not exist in that class but the question I have is, am I doing something wrong or is this a bug? The method seems to be declared in another class but I can't even seem to find the Interceptor class referenced in the error.

This is what my system.xml looks like:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <!-- Add new Tab -->
        <tab id="dummymodule" translate="label" sortOrder="100">
            <label>DummyModule</label>
        </tab>
        <section id="dummymodule" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>DummyModule</label>
            <tab>dummymodule</tab> 
            <resource>Mludd_DummyModule::config_dummymodule</resource>

            <group id="first" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>First</label>
                <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="second/id" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Second</label>
                <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

3 Answers 3

10

I got the same error but my system.xml syntax was correct, so it was something else. Turns out it was the result of my cron_group being incorrectly configured, which caused errors when trying to save cron configuration under Configuration > Advanced > System.

It was fixed by adding this to my cron group: <use_separate_process>1</use_separate_process>

2
  • Thank you Jacco. I had this issue for a while after upgrading to Magento 2.1. This fix helped. Dec 8, 2017 at 13:34
  • Thanks, Jacques your answer is helpful thanks Jul 27, 2020 at 17:34
1

Turns out the issue was that there was a slash (/) in the second group's ID. Removed this and now it saves as intended.

No idea why I thought it would work to put a slash there.

1

group_id should be unique in system.xml and crontab.xml files. It will solve this issue.

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.