Sylius(Symfony)覆盖模板
Sylius(Symfony)覆盖模板,symfony,twig,sylius,Symfony,Twig,Sylius,我想覆盖名为productIndex.html.twig的模板,该模板位于vendor/sylius/sylius/src/sylius/Bundle/WebBundle/Resources/views/Backend/ProductArchetype/productIndex.html.twig中。因此,我将这个文件复制到app/Resources/SyliusWebBundle/views/Backend/ProductArchetype/productIndex.html.twig,就像S
我想覆盖名为
productIndex.html.twig
的模板,该模板位于vendor/sylius/sylius/src/sylius/Bundle/WebBundle/Resources/views/Backend/ProductArchetype/productIndex.html.twig
中。因此,我将这个文件复制到app/Resources/SyliusWebBundle/views/Backend/ProductArchetype/productIndex.html.twig
,就像Symfony说的那样,并对其进行修改。但是Symfony仍然从供应商
中呈现这张图片。我使用Sylius v0.17.0标准edtion
如何修复它?对于Sylius,您需要首先将资源
配置覆盖到您自己的捆绑包,然后覆盖指向您自己模板的路由
sylius.yml
sylius_variation:
classes:
product:
variant:
controller: MyApp\Bundle\CoreBundle\Controller\VariantController
src/MyApp/Bundle/WebBundle/Resources/views/Backend/ProductVariant/index.html.twig
{% extends 'SyliusWebBundle:Backend:layout.html.twig' %}
{% from 'SyliusWebBundle:Backend/Macros:misc.html.twig' import pagination %}
{% from 'SyliusWebBundle:Backend/ProductVariant:macros.html.twig' import list_all %}
{% import 'SyliusResourceBundle:Macros:buttons.html.twig' as buttons %}
{# Do whatever you want #}
可能看起来很明显,但你清除了缓存了吗?