Version

Documentation » Admin

1. Routing »

« 18. Troubleshooting

19. The breadcrumbs builder

Note

This article assumes you are using Symfony 4. Using Symfony 2.8 or 3 will require to slightly modify some namespaces and paths when creating entities and admins.

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:

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

19.1. Configuration

  • YAML
    # 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
    

Found a typo? Something is wrong in this documentation? Just fork and edit it!