Sylius 主题 - 如何修改事件?

问题描述 投票:0回答:2

我正在尝试自定义 Sylius 主题,我想修改页脚。 有事件 sylius.shop.layout.footer 和 sylius.shop.layout.footer.grid。 在配置中,sylius.shop.layout.footer.grid 事件由几个块组成:

供应商/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/config/app/config.yml

        sylius.shop.layout.footer.grid:
            blocks:
                before_legacy:
                    template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
                    priority: 45
                    context:
                        event: sylius.shop.layout.before_footer
                plus:
                    template: "@SyliusShop/Layout/Footer/Grid/_plus.html.twig"
                    priority: 40
                your_store:
                    template: "@SyliusShop/Layout/Footer/Grid/_your_store.html.twig"
                    priority: 30
                customer_care:
                    template: "@SyliusShop/Layout/Footer/Grid/_customer_care.html.twig"
                    priority: 20
                payment_methods:
                    template: "@SyliusShop/Layout/Footer/Grid/_payment_methods.html.twig"
                    priority: 10

我不需要渲染块加。 怎么办?

我创建了配置文件,复制了 sylius.shop.layout.footer.grid 事件并注释了删除的块加上: 配置/包/sylius_ui.yaml

sylius_ui:
    events:
        sylius.shop.layout.footer.grid:
            blocks:
                before_legacy:
                    template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
                    priority: 45
                    context:
                        event: sylius.shop.layout.before_footer
                #plus:
                #    template: "@SyliusShop/Layout/Footer/Grid/_plus.html.twig"
                #    priority: 40
                your_store:
                    template: "@SyliusShop/Layout/Footer/Grid/_your_store.html.twig"
                    priority: 30
                customer_care:
                    template: "@SyliusShop/Layout/Footer/Grid/_customer_care.html.twig"
                    priority: 20
                payment_methods:
                    template: "@SyliusShop/Layout/Footer/Grid/_payment_methods.html.twig"
                    priority: 10

但是模板 @SyliusShop/Layout/Footer/Grid/_plus.html.twig 仍然呈现。 如何更改或修改页脚渲染的模板?

sylius
2个回答
0
投票

在 config/packages/sylius_ui.yaml 中可以禁用块,然后该块不会渲染

sylius_ui:
    events:
        sylius.shop.layout.footer.grid:
            blocks:
                plus:
                    enabled: false

0
投票

您需要将键设置为 false 才能不让块渲染:

sylius_ui:
    events:
         sylius.shop.layout.footer.grid:
              blocks:
                  plus: false
© www.soinside.com 2019 - 2024. All rights reserved.