Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 750 Bytes

twig_configuration.md

File metadata and controls

29 lines (22 loc) · 750 Bytes

Twig configuration

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.

Configuration

#app/config/config.yml
twig:
    globals:
        breadcrumb_trail: "@apy_breadcrumb_trail"

Basic example

<!-- 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() }}