twig.js icon indicating copy to clipboard operation
twig.js copied to clipboard

block function ignores second parameter

Open Nielio opened this issue 6 years ago • 2 comments

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.

Nielio avatar Jun 13 '18 14:06 Nielio

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

olets avatar Jun 15 '18 14:06 olets