getgrav / grav-plugin-form

Grav Form Plugin
http://getgrav.org
MIT License
53 stars 79 forks source link

Template 'data.html.twig' does not have access context variables #569

Open pamtbaau opened 2 years ago

pamtbaau commented 2 years ago

Since data.html.twig, has been refactored with commit https://github.com/getgrav/grav-plugin-form/commit/c5902ed81845fdf80720d4273c5bbeeed1e484eb into a macro, the context variables like base_url are no longer accessible.

By design, Twig macros do not have access to the context.

When the form uses display and/or email actions, all variables are being passed to data.html.twig but since its refactoring into a macro, it does not have access to the context anymore.

This can be fixed as follows:

mahagr commented 2 years ago

Looks like it was your fix. Can you take a look?

pamtbaau commented 2 years ago

A better solution could be to use PHP extract() to assign the content of context into local variables.