我如何影响Shopware 6.4.13.0中的模板加载顺序

发布于 2025-02-13 09:26:13 字数 256 浏览 0 评论 0 原文

这与“ shopware 6”插件已加载?

在不同插件中覆盖模板时,负载顺序很重要,取决于插件安装日期。

我相信在最近的售货机版本中,可以更好地解决此问题。

这是如何工作的?

This is related to In which order are Shopware 6 plugins loaded?

When overwriting templates in different plugins, the load order matters and depends on plugin installation date.

I believe in the recent Shopware version it is possible to solve this in a better way.

How is this working?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

野鹿林 2025-02-20 09:26:13

您可以将最后一个版本 getTemplatePriority 添加到捆绑类。返回的整数用于排序。 https://github.com/shopware/platform/commit/ad0535de2042c2c2c8cbb5c4f203780feae3ba0c70

public function getTemplatePriority(): int
{
    return 500;
}

You can add since the last version a getTemplatePriority to your Bundle class. The returned integer is used for sorting. https://github.com/shopware/platform/commit/ad0535de2042c2c8cbb5c4f203780feae3ba0c70

public function getTemplatePriority(): int
{
    return 500;
}
南街九尾狐 2025-02-20 09:26:13

您无法通过插件方式进行操作,因为主题始终比插件具有更高的视图优先级。

您应该创建一个扩展主题(儿童主题)

开发人员.shopware.com/docs/guides/plugins/ themes/add-theme-inheritance 您可以轻松覆盖模板当前主题。

...
"views": [
     "@Storefront",
     "@Plugins",
     "@SwagBasicExampleTheme",
     "@SwagBasicExampleThemeExtend"
  ],

You cannot do it by plugin way because theme always has higher priority of views than plugins.

You should create an extend theme (child theme) https://developer.shopware.com/docs/guides/plugins/themes/add-theme-inheritance

Then you can easily overwriting templates current theme.

...
"views": [
     "@Storefront",
     "@Plugins",
     "@SwagBasicExampleTheme",
     "@SwagBasicExampleThemeExtend"
  ],

夏至、离别 2025-02-20 09:26:13

您无法通过插件方式做到这一点,因为主题总是比插件具有更高的视图优先级。

在插件中,您可以添加一个从另一个插件延伸的空模板,然后在插件中使用此模板作为别名。

You cannot do it by plugin way because theme always has higher priority of views than plugins.

In your plugin you can add an empty template that extends from another plugin, then use this template in your plugin, as an alias.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文