3

We used to have the expanded element in the group options when setting the system.xml file, e.g.

<sections>
  <groups>
    <groupx>
       <expanded>1</expanded>

but it's no longer there in the new structure in Magento 2, I checked system_file.xsd and couldn't find it. Is there an alternative in Magento 2 to have all the groups expanded by default.

1 Answer 1

9

You can use <attribute type="expanded">1</attribute>

Ex:

<section id="helloworld" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
    <class>separator-top</class>
    <label>Hello World</label>
    <tab>helloworld</tab>
    <resource>Amit_Helloworld::hello_configuration</resource>
    <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
        <label>General Configuration</label>
        <attribute type="expanded">1</attribute>
        <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Module Enable</label>
            <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
        </field>
        <field id="display_text" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
            <label>Display Text</label>
            <comment>This text will display on the frontend.</comment>
        </field>
    </group>
</section>

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.