cakephp / twig-view

Twig View for CakePHP
MIT License
13 stars 7 forks source link

Added configuration for View instance variable name in templates #21

Closed othercorey closed 4 years ago

othercorey commented 4 years ago

This let's you override the default _view template variable name.

ADmad commented 4 years ago

BakeView will need to be updated to keep using old name.

dereuromark commented 4 years ago

I just checked this means now

{{ _view.fetch('content')|raw }}

etc are not working anymore in existing code right?

ADmad commented 4 years ago

@dereuromark No, that never worked, I was mistaken.

dereuromark commented 4 years ago

Ah ok, this was in the .md examples in the repo. And for my tests it seemed to work actually :)

ADmad commented 4 years ago

Err sorry _view.fetch() should work

dereuromark commented 4 years ago

With these changes it now doesnt anymore. So careful with BC here, maybe we need to outline this.

othercorey commented 4 years ago

The readme need a re-write when we are done with all these changes. You can enable BC by setting the viewVar config to _view.

ADmad commented 4 years ago

I just realized that view variables are passed to View using view options key viewVars so using viewVar to customize View instance name is a bit too similar. It would be better to use viewVarName.

othercorey commented 4 years ago

That's probably still too similar. How about contextName.

ADmad commented 4 years ago

contextName sounds good.