-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions
Magento 2.2.2
Steps to reproduce
- Register a new theme with no parent.
- Create
Magento_Themedir and either add a new block infootercontainer with a template that doesn't exist in the core files, or edit the template of an existing block giving it a new template that doesn't exist in the core files.
For example:
<referenceContainer name="footer">
<block class="Magento\Framework\View\Element\Template" name="some.block" template="Magento_Theme::some-template-that-exists-in-my-custom-theme-but-not-in-core.phtml" />
</referenceContainer>
- In chrome for example under network change user agent to whatever is required to enable the theme and visit any product view page.
Expected result
- When user agent matches what is required to enable custom theme, everything works as normal but with custom theme applied.
Actual result
- Invalid Template Error is produced relating to the block which uses a template that is not available in the core files.
For some reason when a theme is a applied based on user agent, it is not applied to certain sections. The footer is one, another is when trying to override review.phtml from Magento_Reviews dir. In the case of the footer because I was using templates that didn't exist in the base module I get the invalid template error because Magento is not applying my theme but looking for my templates in the base module. In the case of Magento_Reviews reviews.phtml there are no errors as the file exists in the base module but the override has no effect as my theme is not applied.
This seems to be selective as custom templates in the header section work fine on the product view page. I've only noticed the footer and reviews.phtml issue but there could be others.