I'm using symfony 3 with EasyAdminBundle
I created a new bundle called AdminBundle child of EasyAdminBundle (to override)
namespace AdminBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AdminBundle extends Bundle {
public function getParent(){
return 'EasyAdminBundle';
}
}
I overrided a method in the controller and it works fine, but when I tried to override a twig template it isn't working...
I created my twig file in AdminBundle/Resources/views/default/list.html.twig
The original is in vendor/javiereguiluz/easyadmin-bundle/Resources/views/default/list.html.twig
How to fix? (I cleared the caches many times...)
When the EasyAdminBundle:default:index.html.twig
is rendered, Symfony actually looks in two different locations for the template:
Your approach is the second option to do this, BUT:
The overriding of resources only works when you refer to resources with the
@FOSUserBundle/Resources/config/routing/security.xml
method. If you refer to resources without using the @BundleName shortcut, they can't be overridden in this way. [See Doc]
To override the bundle template, just copy the index.html.twig
template from the bundle to app/Resources/EasyAdminBundle/views/default/index.html.twig
(the app/Resources/EasyAdminBundle
directory won't exist, so you'll need to create it). [See Doc]
If you add a template in a new location, you may need to clear your cache (
php bin/console cache:clear
), even if you are in debug mode.