How does Magento handle layout XML files?
For example if I have created a theme app/design/frontend/example/theme
and copy an XML file from the base/default/layout
directory in my theme's layout directory:
- Does it override the whole file? Meaning will I have to copy the XML file into my theme to begin overriding things, or
- Does it merge with the base/default and override only the changes I have made in my XML file?
Best Answer
In brief, this is how Magento loads layout files:
If it exists in your theme, it loads it and goes directly to step 4.
base/default
theme.local.xml
file in your theme, and appends whatever is there, to the previously merged layout handles.So, unless absolutely required,
local.xml
for changing the layout of a theme, instead of copy/pasting the xml files from base to your theme.