yiisoft/yii2-twig

Provide support for twig yielding

diffy0712 opened this issue · 0 comments

I open this issue to start a conversation and possibly find solution for yielding support for twig4.

Twig 3.9 introduced the use_yield option, which will be the only strategy in twig4. Read the changelog here.

Pull request #154 added support for the internal changes that were made in 3.9, but still relies on echo and the output buffer. (use_yield is off).

The yii2-twig library creates twig functions for yii's View helper functions (beginBody, endBody, beginPage etc...), which will echo their contents, which does not work in twig3.9 with use_yield. Note: endPage will modify the current output buffer (replacing the placeholders), which already has a workaround from 2.5.0.

I think a solution needs to be found to support yielding, because echo is deprecated from twig3.9 and will be removed in twig4.

CC: @schmunk42 @eluhr