Magento Tips & Tricks

Configuration group expanded by default

Most magento extension has its own section in admin configuration. Sometimes you want to have one of configuration groups to be expanded. All you need to do is add expanded parameter to it. It will define whether the group is expanded by default when viewing that particular tab section.

Configuration section / groups defined in app/code/community/[Company]/[Extension]/etc/system.xml. Typical system.xml looks like

<config>
    <sections>
        <section_name translate="label" module="Extension">
            ...
            <groups>
                <group_name translate="label">
                    ...
                    <fields>
                        ...
                    </fields>
                </group_name>
            </groups>
        </section_name>
    </sections>
</config>

You need to add expanded parameter to group_name.
Here is live example from Powerbanners extension.

Example of expanded configuration group

<config>
    <sections>
        <powerbanners_options translate="label" module="powerbanners">
            <label>Power Bannners Configuration</label>
            <tab>nwdall</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <general translate="label">
                    <label>General</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <expanded>1</expanded>
                    <fields>
                        <status translate="label">
                            <label>Status</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </status>
                    </fields>
                </general>
            </groups>
        </powerbanners_options>
    </sections>
</config>

One thought on “Configuration group expanded by default

Leave a Reply

Your email address will not be published. Required fields are marked *