Magento 2 – template path hints
An often used help in Magento development is backend option template path hints. You may already know this from Magento 1, you can find the same in Magento 2 and I show you where and how to use this template path hints for your work.
Magento 2 – template path hints
This hints can be make available under:
1 | Store -> Configuration-> Advanced -> Developer -> Debug -> Enabled Template Path Hints for Storefront |
set this option to Yes and reload your frontend site. You will see red lines that cover each template block and labels it with path to *.phtml file. With this it is really easy to find and edit correct file. It is also easy to find out if a custom theme may overload such a file or if it comes from base.
With another useful option “Add Block Names To Hints” you can also get block names, which is very useful if you need to change layout *.xml files.
Backend template path hints
You may also discover “Enable Template Path Hints for Admin”. You can now enable it in adminhtml. I already showed in Magento template path hints for admin how difficult this was to be done in Magento 1. It is not very common to use this, but if you work on an own module, or debugging of an existing one, you may need this option.
IP address filter
You may know IP address filters for this hints from Magneto 1. This filter does not exists anymore. For Magento 2 development it is essential to have a development system and to do this tasks there!
Conclusion
As developer you will need template path hints very often. Especially if you are working on a new shop with for you unknown custom templates. Finding correct *.phtml files for you visible block is a common task. It speeds up development a lot if you know where to search.