Twig Shopware 6-不使用自定义主题

Twig Shopware 6-不使用自定义主题,twig,shopware,Twig,Shopware,你好,因为某些原因,shopware没有使用我的自定义主题。 我遵循官方的例子,最终得出以下结论: E:\XAMPP\htdocs\sw\custom\plugins\MyPlugin\src\Resources\views\storefront\layout\header\logo.html.twig 不幸的是,当现在使用 theme:compile plugin:update MyPlugin cache:clear 网站上没有可见的变化。我确保店面和无头销售渠道使用我的主题。槽: th

你好,因为某些原因,shopware没有使用我的自定义主题。 我遵循官方的例子,最终得出以下结论:

E:\XAMPP\htdocs\sw\custom\plugins\MyPlugin\src\Resources\views\storefront\layout\header\logo.html.twig
不幸的是,当现在使用

theme:compile
plugin:update MyPlugin
cache:clear
网站上没有可见的变化。我确保店面和无头销售渠道使用我的主题。槽:

theme:change 
对话进行了两次

模板中的代码如下所示:

{% sw_extends '@Storefront/storefront/layout/header/logo.html.twig' %}

{% block layout_header_logo_link %}
    <h2>Hello world!</h2>
{% endblock %}
{%sw_扩展'@Storefront/Storefront/layout/header/logo.html.twig%}
{%block layout\u header\u logo\u link%}
你好,世界!
{%endblock%}
非常感谢您的帮助


非常感谢您。

问题在于,自动生成插件和主题伪代码的工具将
theme.json
文件中的插件名称弄乱,导致实际上没有任何行为

因此,请确保

"views": [
     "@Storefront",
     "@Plugins",
     "@myPlugin"
  ],
改为

"views": [
         "@Storefront",
         "@Plugins",
         "@MyPlugin"
      ],

注意最后一行的更改,确保名称与您的插件名称匹配,然后您就可以开始了。

有时它与缓存相关,所以在设置中删除缓存或在project root中运行命令
psh.phar cache
,您也可以使用命令
bin/console cache:clear
它实际上与缓存无关,该工具只是创建了一个名称错误的插件模板。