You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an exception is thrown or an error occurs in a custom form rendering template, in devMode, exceptions that are displayed on the front-end are hard to debug because the original Twig template file is unknown to the view layer and therefore it cannot show the template code where the exception occurred. This is because the template is loaded as a sting instead of a file.
A fix to this would be to change this call for view->renderFile() (dropping the file_get_contents() wrapper around $templatePath of course):
I should add that I have just been trying this out while working on my form template. I am getting issues with different contexts using renderFile(), but there are other options of course like renderTemplate() which would work but will require a template path relative to a template root rather than an absolute file path as is the case now.
When an exception is thrown or an error occurs in a custom form rendering template, in
devMode
, exceptions that are displayed on the front-end are hard to debug because the original Twig template file is unknown to the view layer and therefore it cannot show the template code where the exception occurred. This is because the template is loaded as a sting instead of a file.A fix to this would be to change this call for
view->renderFile()
(dropping thefile_get_contents()
wrapper around$templatePath
of course):craft-freeform/packages/plugin/src/Services/FormsService.php
Lines 346 to 352 in 502ee66
This seems to work well here.
Steps to reproduce
devMode
switched on so "friendly" errors with traces are shown__TwigTemplate_e733123153b2c97d929a8fefb509ae2a
instead of the Twig source from the file.Expected behavior
In the exception front-end view, show the line and Twig context.
Craft & Plugin Info (please complete the following information):
The text was updated successfully, but these errors were encountered: