0

I'm trying to override show.html.twig in the context of SonataClassificationBundle/CategoryAdmin

I've tried putting it in /app/Resources/SonataClassificationBundle/views/CategoryAdmin/show.html.twig but it doesn't work.

I'm using Symfony 3.2.7.

M--
  • 25,431
  • 8
  • 61
  • 93
Oriol Planas
  • 107
  • 9

2 Answers2

0

I don't see the show.html.twig file in original bundle directory.

https://github.com/sonata-project/SonataClassificationBundle/tree/3.x/Resources/views/CategoryAdmin

Mehmet S.
  • 394
  • 3
  • 18
  • 1
    Sorry, I've forgot to say. the original file is here: /vendor/sonata-project/admin-bundle/Resources/views/CRUD/show.html.twig All the admin services in sonata-admin use it. – Oriol Planas Apr 28 '17 at 19:34
0

Finally I've found the solution (almost one):

I've editd CategoryAdmin overrideing this function:

class CategoryAdmin extends BaseCategoryAdmin
{
    public function getTemplate($name) {
        if ($name == 'show') {
            return 'ApplicationSonataClassificationBundle:CategoryAdmin:show.html.twig';
        } else {
            return parent::getTemplate($name);
        }

    }
}
Oriol Planas
  • 107
  • 9