Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 792 Bytes

twig_configuration.md

File metadata and controls

29 lines (22 loc) · 792 Bytes

Twig configuration

Adding breadcumbs to the trail in your template directly works exactly like the PHP configuration. In order to do so, you just have to add the service in a global variable.

Configuration

#app/config/config.yml
twig:
    globals:
        breadcrumb_trail: "@APY\BreadcrumbTrailBundle\BreadcrumbTrail\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() }}