TransWikia.com

Magento 2: How to set default layout to 1column

Magento Asked by nhinzky on November 25, 2021

I have no idea where to set the default layout in creating a page in the backend where I want it to set the layout to “1 Column” instead of the default value “Empty”.

empty layout

Anyone have the idea?

2 Answers

1. Create a UI Component XML extending file

Create [Your_Namespace]/[Your_Module]/view/adminhtml/ui_component/cms_page_form.xml.

(Also, add <module name="Magento_Cms"/> to the module's <sequence/> in module.xml.)

2. Insert the following code

Replace [1column] below without any other page_layout ID.

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="design">
        <field name="page_layout">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">[1column]</item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

Answered by bassplayer7 on November 25, 2021

You have to override UiComponent xml file and add this code into design fieldset >> field:

<argument name="data" xsi:type="array">
       <item name="config" xsi:type="array">
            <item name="source" xsi:type="string">page</item>
            <item name="default" xsi:type="number">1</item>
      </item>
</argument>

Answered by Ronak Chauhan on November 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP