Sylius:如何在网格中引用自己的树枝模板?

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

这不是例如Referencing a template in Twig / Symfony2,因为不再建议/不建议将捆绑软件作为应用程序创建,因此答案不再适用。如何在Sylius网格中引用我自己的模板?

我尝试过的事情:

1。

                options:
                    template: "@App/Order/Grid/Field/channel.html.twig"

2。

                options:
                    template: ":Order/Grid/Field:channel.html.twig"

3。

                options:
                    template: "templates/Order/Grid/Field/channel.html.twig"

4。

                options:
                    template: "Order/Grid/Field/channel.html.twig"

((我根据文档尝试了其中的一些:https://docs.sylius.com/en/1.6/components_and_bundles/bundles/SyliusGridBundle/field_types.html#twig-twighttps://docs.sylius.com/en/1.6/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html

在所有情况下,都表示未找到模板。有什么想法吗?

symfony templates grid symfony4 sylius
1个回答
1
投票

您如何创建或自定义网格?例如,我试图自定义“管理”>“目录”>“选项”网格,因此通过this tutorial将这些行放在config/packages/_sylius.yaml文件的末尾:

sylius_grid:
    grids:
        sylius_admin_product_option:
            fields:
                name:
                    type: twig
                    options:
                        template: "Grid/mytemplate.html.twig"

第二,我在/ templates中创建文件夹“ Order”,然后在“ Order”目录中创建“ Grid”文件夹,然后在“ Grid”目录中创建文件夹“ Field”。在那里,我创建带有任何内容的文件“ mytemplate.html.twig”。您是否尝试过类似的步骤?

© www.soinside.com 2019 - 2024. All rights reserved.