3

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 2

0

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>
8
  • Thanks @Ronak Chauhan. Can you give me the path of the file that I need to change?
    – nhinzky
    Oct 3, 2017 at 5:33
  • Which module you want to change ? Oct 3, 2017 at 5:35
  • I provide you solution for content >> page Oct 3, 2017 at 5:35
  • It's for Content->Page. Yeah i want it to have the default "1 Column" so that I don't need to edit it everytime.
    – nhinzky
    Oct 3, 2017 at 5:39
  • ok then override file : /vendor/magento/module-cms/view/adminhtml/ui_component/cms_page_form.xml Oct 3, 2017 at 5:40
0

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>

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.