Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version

19. The breadcrumbs builder

4.x version
Maintained

19. The breadcrumbs builder

The sonata.admin.breadcrumbs_builder service is used in the layout of every page to compute the underlying data for two breadcrumbs:

  • one as text, appearing in the title tag of the document’s head tag;
  • the other as html, visible as an horizontal bar at the top of the page.

Getting the breadcrumbs for a given action of a given admin is done like this:

$this->get('sonata.admin.breadcrumbs_builder')->getBreadcrumbs($admin, $action);

19.1. Configuration

  • YAML
    1
    2
    3
    4
    5
    6
    7
    # config/packages/sonata_admin.yaml
    
    sonata_admin:
        breadcrumbs:
           # use this to change the default route used to generate the link
           # to the parent object inside a breadcrumb, when in a child admin
           child_admin_route: edit
    

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.