I am trying to override the file app/code/Magento/Theme/view/frontend/layouts.xml

I do not want to extend this file, I want to override it so that some of the base design layouts are not available in the admin.


Instead of overriding layouts.xml I ended up doing the following

Create a new Module: app/code/<Vendor>/Cms

Create the file: app/code/<Vendor>/Cms/Model/PageLayout.php


namespace <Vendor>\Cms\Model;

use Magento\Cms\Model\Page\Source\PageLayout as BasePageLayout;

class PageLayout extends BasePageLayout{

    public function toOptionArray()
        $options = parent::toOptionArray();
        $remove = [

        foreach($options as $key => $layout){
            if(in_array($layout["value"], $remove)){

        return $options;

This will get the $options and then remove any that are in the $remove array based on the $option['value']

In order to have this run, you need to override part of app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml

To do this create the file: app/code/<Vendor>/Cms/view/adminhtml/ui_component/cms_page_form.xml

<?xml version="1.0" encoding="UTF-8" ?>
<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="options" xsi:type="object"><Vendor>\Cms\Model\PageLayout</item>

We are now telling that ui_component field to use our new Model to retrieve the options.

You can also create the file app/code/<Vendor>/Cms/view/adminhtml/ui_component/cms_page_listing.xml

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="cms_page_columns">
        <column name="page_layout">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object"><Vendor>\Cms\Model\PageLayout</item>

Simply put your layout file inside "/override/base" folder.

In your case your layout file will be located in "theme_or_module_folder/Magento_Theme/layout/override/base/layouts.xml"

For more information see http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-override.html

  • I believe this only overrides files inside app/code/Magento/Theme/view/frontend/layouts/*.xml. This file is outside of that folder. I tried adding the file as you described and I get the following error: Overriding view file '/var/www/html/app/design/frontend/vendor/theme/Magento_Theme/layout/override/base/layouts.xml' does not match to any of the files – Shawn Northrop Dec 11 '17 at 23:13
  • Can you try to put the file inside the override folder instead of base? – DustyMan Dec 12 '17 at 1:54
  • nope didn't seem to work – Shawn Northrop Dec 12 '17 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.