SchumacherFM / Magento2-Twig

Twig Template Engine for Magento2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Plugin to overwrite .phtml files in template for .html.twig

wouter-toppy opened this issue · comments

Add a Plugin on the \Magento\Framework\View\Element\Template Class. when an Block is calling _toHtml() it finaly calls _toHtml() in Template which calls fetchView()

this is checking if an .phtml files excists and render it. or throw an error.

how if you want to build your template in Twig. normally you overwrite an default .phtml file using the same directory structure. so if you want to overwrite it with twig your template files are not called.

an plugin that checks on the .html.twig file and than execute the '_toHtml()' wil fix this.
(just an replace of .phtml to .html.twig of the current template set in the block)

added in pull request
#11

Thanks. If some complains with this change that something isn't working anymore, I'll get back to you.