Skip to content
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

Closed
SeriousKen opened this issue May 23, 2018 · 9 comments
Closed

Unknown "dump" function in "getTwigNodeTree" #337

SeriousKen opened this issue May 23, 2018 · 9 comments

Comments

@SeriousKen
Copy link

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.

@SeriousKen
Copy link
Author

Sorry, should have said this error occurs in the backend when trying to edit a page, not when viewing the page.

@SeriousKen
Copy link
Author

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.

https://github.com/octobercms/october/blob/8ba63dd428b425a3722fb18c6ce5e58f03be5314/modules/cms/classes/CmsCompoundObject.php#L401-L419

@SeriousKen
Copy link
Author

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.

@SeriousKen
Copy link
Author

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).

@LukeTowers
Copy link
Contributor

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.

@SeriousKen
Copy link
Author

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.

@LukeTowers
Copy link
Contributor

@SeriousKen I'm reopening this issue until octobercms/october#3575 is merged, thanks for submitting that!

@daftspunk
Copy link
Member

Fixed in OCMS v2.0.20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants