Sylius:如何在网格中引用自己的树枝模板?
Sylius: How to reference your own twig template in a grid?
这不是例如Referencing a template in Twig / Symfony2 因为不再建议 deprecated/not 推荐将捆绑包创建为应用程序,因此答案不再适用。如何在 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-twig , https://docs.sylius.com/en/1.6/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html)
在所有情况下都说找不到模板。有什么想法吗?
如何创建或自定义网格?例如,我正在尝试自定义 Admin > Catalog > Options 网格,因此 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"。您是否尝试过类似的步骤?
这不是例如Referencing a template in Twig / Symfony2 因为不再建议 deprecated/not 推荐将捆绑包创建为应用程序,因此答案不再适用。如何在 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-twig , https://docs.sylius.com/en/1.6/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html)
在所有情况下都说找不到模板。有什么想法吗?
如何创建或自定义网格?例如,我正在尝试自定义 Admin > Catalog > Options 网格,因此 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"。您是否尝试过类似的步骤?