Assets defined in overridden blocks of embedded Twig templates are not loaded #585

Merged
merged 2 commits into from Mar 18, 2014

Conversation

Projects
None yet
2 participants
@bangpound
Contributor

bangpound commented Mar 4, 2014

Using the Twig embed tag, I am including a template and extending/overriding blocks within it. This is the code in question:

{% block footer %}
    {% embed 'Bundle::footer.html.twig' %}
        {% block sponsors %}
            {{ parent() }}
            <li>
                <a href="http://website.org">
                    {% image '@Bundle/Resources/public/images/logo.png' %}
                    <img src="{{ asset_url }}" alt="Organization Logo" />
                    {% endimage %}
                </a>
            </li>
        {% endblock %}
    {% endembed %}
{% endblock %}

However, the blocks inside the embed tag are never scanned for instances of AsseticNode, because the embedded template is not a child but rather it's an attribute on the node.

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Mar 5, 2014

Collaborator

Please add a test for this

Collaborator

stof commented Mar 5, 2014

Please add a test for this

@bangpound

This comment has been minimized.

Show comment
Hide comment
@bangpound

bangpound Mar 18, 2014

Contributor

I've added a test.

The test proves that the asset in the embed.twig is identified when the embedded.twig template is embedded and its assets block is overridden.

Contributor

bangpound commented Mar 18, 2014

I've added a test.

The test proves that the asset in the embed.twig is identified when the embedded.twig template is embedded and its assets block is overridden.

stof added a commit that referenced this pull request Mar 18, 2014

Merge pull request #585 from bangpound/hotfix/load-assets-from-overri…
…dden-blocks-in-embed-template

Assets defined in overridden blocks of embedded Twig templates are not loaded

@stof stof merged commit c501da7 into kriswallsmith:master Mar 18, 2014

1 check passed

default The Travis CI build passed
Details

@bangpound bangpound deleted the bangpound:hotfix/load-assets-from-overridden-blocks-in-embed-template branch Apr 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment