Add breadcumbs to the trail with Twig in your template works exactly like the PHP configuration.
You just have to add the service in a global variable.
#app/config/config.yml
twig:
globals:
breadcrumb_trail: "@apy_breadcrumb_trail"
<!-- MyProject\MyBundle\Resources\views\myTemplate.html.twig -->
{% do breadcrumb_trail.add('My new breadcrumb') %}
{{ apy_breadcrumb_trail_render() }}
Functions are chainable so you can write this code:
<!-- MyProject\MyBundle\Resources\views\myTemplate.html.twig -->
{% do breadcrumb_trail.reset().add('breadcrumb 1').add('breadcrumb 2') %}
{{ apy_breadcrumb_trail_render() }}