twigjs / twig.js

JS implementation of the Twig Templating Language
BSD 2-Clause "Simplified" License
1.88k stars 275 forks source link

block function ignores second parameter #564

Open Nielio opened 6 years ago

Nielio commented 6 years ago

Asume you have a file foo.twig

<div class="sg-cw-col-xs-12">
  {% block product_info_1 %}
    <label>Some stuff</label>
  {% endblock %}
</div>

In file bar.twig you want just to output the block product_info_1

<div class="sg-cw-col-xs-6">
  {{ block('product_info_1', 'foo.twig') }}
</div>

Nothing will be outputed. Trying {{ block('product_info_1', 'foo.twig') is defined }} also returns false.

It seems the second argument is ignored.

olets commented 6 years ago

Nice catch, twig.js doesn't support passing a custom template to the block() function.

For reference, it was introduced to Twig in https://github.com/twigphp/Twig/pull/2245

willrowe commented 2 years ago