rybakit / twig-deferred-extension

An extension for Twig that allows to defer block rendering.
MIT License
109 stars 3 forks source link

Setting data not working when we include a template from string #5

Closed mewgan closed 6 years ago

mewgan commented 7 years ago

Is it possible to set data from a string template and include it after ?

{# page.html.twig #}
{% extends "layout.html.twig" %}

{% block content %}
    {{ data.append('/js/page-header.js') }}

   {{ include(template_from_string(my_template)) }}

    {{ data.append('/js/page-footer.js') }}
{% endblock %}
{# my_template #}
{{ data.append('/js/subpage1.js') }}
rybakit commented 6 years ago

@Mewgan @lachieh Sorry for the late reply. I tested the template_from_string() inclusion and didn't find any issues: https://github.com/rybakit/twig-deferred-extension/blob/master/tests/Fixtures/include.test#L7-L8.

rybakit commented 6 years ago

Closing the issue. Feel free to reopen it in case it still doesn't work for you.