Sylius themes - how to modify event?

157 views Asked by At

I'm trying to customize the Sylius theme and I would like to modify the footer. There are events sylius.shop.layout.footer and sylius.shop.layout.footer.grid. In config, the sylius.shop.layout.footer.grid event consists from several blocks:

vendor/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

I need to not render block plus. How to do it?

I created config file, copied sylius.shop.layout.footer.grid event and commented removed block plus: config/packages/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

But template @SyliusShop/Layout/Footer/Grid/_plus.html.twig is still rendered. How to change or modify from which templates is footer rendered?

2

There are 2 answers

0
Stephan Hochdoerfer On

You need to set the key to false to not let the block render:

sylius_ui:
    events:
         sylius.shop.layout.footer.grid:
              blocks:
                  plus: false
0
Petr Uttendorfsky On

in config/packages/sylius_ui.yaml it is possible to disable a block, then the block will not rendered

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