InsideDarkWeb.com

Magento 2: How to set default layout to 1column

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?

Magento Asked by nhinzky on November 25, 2021

2 Answers

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!

Related Questions

is creating block within template in magento 2 good practice

0  Asked on July 24, 2020 by herve-tribouilloy

       

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.