shopware / shopware

Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
https://shopware.com
MIT License
2.82k stars 1.03k forks source link

{% parent %} not working as expected in Administration #2279

Closed runelaenen closed 2 years ago

runelaenen commented 2 years ago

PHP Version

8.0

Shopware Version

6.4.7.0

Expected behaviour

Start custom block 1
Block two!
End custom block 1

Actual behaviour

Start custom block 1
Start block 1
Block two!
End block 1
End custom block 1

How to reproduce

In PHP twig, we have the {{ parent() }} notation which will call the block of the parent page you're extending. On the twig.js, it does not work the same. It works great on level 1, but not any deeper than that. {% parent %} always calls the extended block of the first level.

a.html.twig

{% block test_level_one %}
    Start block 1
    {% block test_level_two %}
        Block two!
    {% endblock %}
    End block 1
{% endblock %}

b.html.twig

{% extends 'a.html.twig' %}

{% block test_level_one %}
    Start custom block 1
    {% block test_level_two %}
        {% parent %}
    {% endblock %}
    End custom block 1
{% endblock %}
runelaenen commented 2 years ago

For the record, I was first creating an issue in the twig.js repo, but it seems that the {% parent %} tag is shopware-specific, and not from Twig.js itself?

/vendor/shopware/administration/Resources/app/administration/build/nuxt-component-library/lib/file-parser/twig-components/index.js line 30

shyim commented 2 years ago

Slots using Extension SDK is the future. So we would not invest time to change that 😅