contao / contao

Contao Open Source CMS
https://contao.org
GNU Lesser General Public License v3.0
340 stars 158 forks source link

Twig Template: Extending News bundle template leads to Exception #7020

Closed derMatze82 closed 6 months ago

derMatze82 commented 6 months ago

Affected version(s)

4.13.38

Description

In Contao 4.13.37, the following worked: {% extends '@Contao_ContaoNewsBundle/modules/mod_newsreader.html5' %} In Contao 4.13.38, an exception is thrown: ... Template \"@Contao_ContaoNewsBundle/modules/mod_newsreader.html5\" is not defined in ... Have I overlooked something, or am I doing something wrong?

fritzmg commented 6 months ago

Please post the path and content of your template.

derMatze82 commented 6 months ago

Sure!

# bundles/MyVendor/MyBundle/src/Resources/contao/templates/modules/mod_newsreader_jobs.html.twig

{% trans_default_domain "contao_tl_news" %}
{% extends '@Contao_ContaoNewsBundle/modules/mod_newsreader.html5' %}

{% block content %}

    {{ '{{picture::public/bundles/myvendormybundle/img/jobs/job-detail-header.jpg?size=7}}' }}

    {{ articles | raw }}

{% endblock %}
m-vo commented 6 months ago

Why are you using the specific namespace instead of the managed namespace (@Contao)?

m-vo commented 6 months ago

Also, there is very likely no such template in that subdirectory. That would need a twig root file in the main template directory.

{% extends '@Contao/mod_newsreader.html5 %}

derMatze82 commented 6 months ago

I have already tried various namespaces, but the error remains @Contao @ContaoNewsBundle @Contao_NewsBundle Could you please provide the correct namespace?

derMatze82 commented 6 months ago

I can confirm that it works with {% extends '@Contao/mod_newsreader.html5' %} and {% extends '@Contao/mod_newslist.html5' %}