Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant extend template #64

Closed
dahormez opened this issue Jun 3, 2019 · 1 comment
Closed

Cant extend template #64

dahormez opened this issue Jun 3, 2019 · 1 comment

Comments

@dahormez
Copy link
Contributor

dahormez commented Jun 3, 2019

Hi,

i've created a plugin, which need to extend the web storefront via twig.

Most of the templates work but for example those don't:
{% sw_extends '@Storefront/component/product/card/box-standard.html.twig' %}
{% sw_extends '@Storefront/element/cms-element-image.html.twig' %}

I thought it's the dash in the name, but following works:
{% sw_extends '@Storefront/layout/header/search-suggest.html.twig' %}

And I thought it's the include by {% sw_include .. %}, but following works:
(inlucde in aside-item.twig)
{% sw_extends '@Storefront/page/checkout/_item/product-aside.html.twig' %}

I tried to debug the process but didn't found anything which helps me to extend the template correct.

More Information:
Views path: custom/plugins/pluginName/src/Resources/views

Not working template paths:

  • custom/plugins/pluginName/src/Resources/views/component/product/card/box-standard.html.twig
  • custom/plugins/pluginName/src/Resources/views/element/cms-element-image.html.twig

Cheers.

@pweyck
Copy link
Collaborator

pweyck commented Jun 4, 2019

Hey dahormez,

sw_include does not work with non-constant strings. It ignores sw_extends chain if if the template is computed. For example, that happens with {% sw_include "@Storefront/component/product/card/box-" ~ layout ~ ".html.twig" %} and {% sw_include "@Storefront/element/cms-element-" ~ element.type ~ ".html.twig" ignore missing %}.

We have a fix ready and are currently testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants