Skip to content

Conversation

@RomainMazB
Copy link
Contributor

Here is my first attempt to fix #578 without reintroducing a global context.

Two concerns here disturb me:

  • The Twig MacroTokenParser class is final so we need to rewrite the full class
  • Most important: In the Refactor Twig registration and usage #455 PR, @LukeTowers removed the controller property inside the Twig cms Extension class, but without this, I can't get any reference of the currently running controller to retrieve the controller context's variable, so afaik we need to reintroduce it. I created a method setController to bind the controller to the extension.

@RomainMazB RomainMazB mentioned this pull request Jul 9, 2022
LukeTowers added a commit that referenced this pull request Jul 10, 2022
…ig macros.

This fixes #578 by adding the ability to pass the CMS Controller instance to the CMS Twig Extension removing the reliance on context variables as well as making the expected "global" twig variables inside of the CMS Twig environment actually global within that environment.

Replaces #598 & #593.

Credit to @RomainMazB for the initial implementation.
@LukeTowers
Copy link
Member

Replaced by 5b8d189, thanks for your help @RomainMazB!

@LukeTowers LukeTowers closed this Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants