-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
While using the modman
I issued error which occurs when a module is placed somewhere outside the Magento 2 root directory. This is not the modman
-related things because it can be reproduced to any module which is placed outside the Magento 2 root.
I found out the Magento2 fails where the template is validating against isFile
(at \Magento\Framework\View\Element\Template\File\Validator::isValid
).
I've also managed to fix that by changing the \Magento\Framework\Filesystem\Directory\Read::isFile
method which is used to validate the template file. The problem is that method by default is joining the passed argument $path
with the Magento 2 root, while the template file symlink is a resolved path to the real file.
You can preview my changes in the diff
file.
Preconditions
- Magento 2.
Steps to reproduce
- Create module which is using frontend templates and place the code somewhere outside the Magento 2 root directory, but symlink the code to the place under Magento 2 project where it should be.
- Setup your new module.
Expected result
- If the template file is valid, everything should be working
Actual result
system.log
message:main.CRITICAL: Invalid template file: '/home/tlaziuk/git/Example_Module/view/frontend/templates/example.phtml' in module: 'Polcode_GoogleTagManager' block's name: 'googletagmanager' [] []