APY / APYBreadcrumbTrailBundle

Generate a dynamic Twig breadcrumbs trail via Annotations, PHP Attributes or PHP methods.
80 stars 31 forks source link

Overriding template in Symfony 5 #63

Closed algorun77 closed 3 years ago

algorun77 commented 3 years ago

Hello,

I've been using the bundle in a Symfony2 project and I'm now trying to implement it in a Symfony5 project. It works great but I'm a bit confused about the overriding of the default template.

Looking through the others issues, I'm not even sure if the bundle supports Symfony 4/5. After trying different things, I'm asking for a little help.

I tried to follow the documentation : https://github.com/APY/APYBreadcrumbTrailBundle/blob/master/src/Resources/doc/override_template.md, but it's not up to date for Symfony5 as the config/config.yml file does not exist anymore. It should be replaced by a "apy_breadcrumb_trail.yaml" file, with the same config inside.

Not a big deal, I did it, but now I've got an error saying that Twig cannot find my template. I tried different syntaxes :

The last one actually works... but it use the default template, not mine. Following the Symfony documentation, I've put my template in tempaltes/APYBreadcrumbTrailBundle/Resources/views/breadcrumbtrail.html.twig (https://symfony.com/doc/current/bundles/override.html#templates) but nothing ever works.

I'm using the following versions :

Anyone can tell me what I am missing here ? The bundle documentation is still written for Symfony 2, so it's quite confusing.

Thanks a lot !

algorun77 commented 3 years ago

Oops, Just after posting the issue, I've realized I misunderstood what the Symfony doc was saying.

So the templates was supposed to be DIRECTLY in the templates/APYBreadcrumbTrailBundle folder, not in any subfolder because the original template was DIRECTLY in Resources/views.

Now it works! Sorry for the troubles.

However, it would be great if the bundle's doc was updated :smiley:

rvanlaak commented 3 years ago

Could you help us with creating a PR for that?

algorun77 commented 3 years ago

Sure, I'll try to do it when I'm not too busy