-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown "dump" function in "getTwigNodeTree" #337
Comments
Sorry, should have said this error occurs in the backend when trying to edit a page, not when viewing the page. |
Seems to be related to this block of code in the main October CMS code which doesn't add the debug extension to the Twig environment. |
@SeriousKen it does add them, it just seems to not be doing it properly in your case. See https://github.com/octobercms/october/blob/8ba63dd428b425a3722fb18c6ce5e58f03be5314/modules/cms/classes/CmsCompoundObject.php#L415 and https://github.com/octobercms/october/blob/master/modules/system/twig/Extension.php#L46 |
It does not add the DebugExtension, compare with how Twig is newed up in the controller https://github.com/octobercms/october/blob/8ba63dd428b425a3722fb18c6ce5e58f03be5314/modules/cms/classes/Controller.php#L508-L514 particularly lines 512-514 This is the only place the DebugExtension is referenced. To be honest, shouldn't the responsibility of creating the Twig environment be moved to the container? We seem to have code repetition and a hard dependency on Twig otherwise. |
Another look over the code and I'm wondering whether getTwigNodeTree should actually be on the CmsCompoundObject at all. It's not used in the core of OctoberCMS and is only called in the Pages plugin (in the plugins I have installed anyway). |
Ah, I see. I thought you were talking about the Twig DD plugin. If you would like to propose a refactor of how that is done then feel free to make a PR with your recommendations for moving it to the container. |
I'm closing this issue here as it looks more that it is a problem caused by the core of OctoberCMS rather than an issue with the Pages plugin. I'll look into submitting a PR on that repository. |
@SeriousKen I'm reopening this issue until octobercms/october#3575 is merged, thanks for submitting that! |
Fixed in OCMS v2.0.20 |
I have a debugging layout that uses the dump function to output the Twig variables, but this layout does not work with the Static Pages plugin giving the above error. I presume the Static Pages plugin is using a different instance of the Twig parser which does not have the dump function registered.
The text was updated successfully, but these errors were encountered: