0

So I copied public_html/vendor/magento/module-theme/view/frontend/layout/default.xml to public_html/app/design/frontend/<vendor>/<themeName>/Magento_Theme/layout/default.xml

I did not change the contents of default.xml

And yet the "default" search that lives in the header next to the logo disappears…

If I remove the <container name="header-wrapper"> section from new default search will pop back in.

This doesn't make any sense, since public_html/vendor/magento/module-search/view/frontend/layout/default.xml targets header-wrapper for the topSearch block.

So duplicated default.xml into my theme from the module shouldn't cause search to spontaneously no longer render?

1 Answer 1

0

You don't need to duplicate that file at all, that is the base file.

The file you have in your theme will replace the file in the base theme, e.g /vendor/magento/theme-frontend-blank/Magento_Theme/layout/default.xml

If you need to make changes to the base file you do so by moving, removing or simply not displaying elements via commands in your theme layouts.

4
  • But my theme doesn't have a Parent set and thus doesn't use /vendor/magento/theme-frontend-blank/Magento_Theme/layout/default.xml Jun 9, 2016 at 17:44
  • OK, but it replaces that file in terms of functionality. Basically there is no need to replicate the contents of the file you copied, don't do that, you will cause duplication which may break things such as the search. What are you actually trying to change with your local layout file? Jun 10, 2016 at 9:27
  • I'm not trying to change anything right now, more getting to grips with Magento 2 really, so I can get a theme up and going. Jun 10, 2016 at 10:48
  • OK, so just don't worry about it. You should not be trying to duplicate that file, the content of that file is there to modify the base layout, not to replace it. Jun 10, 2016 at 11:10

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.