XaminProject / handlebars.php

Handlebars processor for php
331 stars 134 forks source link

How to test if helper was used as block or non block? #156

Closed jcubic closed 7 years ago

jcubic commented 7 years ago

I want to implement set helper that will add new element to existing context (or update context) if used normally and push new element on context stack if used as block. How can I distinguish those two cases in helper code?

everplays commented 7 years ago

@jcubic I think you can use the 4th parameter passed to the helper to determine if it's used as block or not.

jcubic commented 7 years ago

Thanks, that works.