fabz29/breadcrumb-bundle

Fabz29BreadcrumbBundle is a Symfony Bundle created to facilitate the management of breadcrumbs in your project.

Installs: 410

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 4

Forks: 1

Open Issues: 0

Type:symfony-bundle

dev-master 2019-08-27 06:41 UTC

This package is auto-updated.

Last update: 2024-04-27 16:31:35 UTC


README

Fabz 29 Breadcrumb Bundle is a Symfony Bundle created to be the most simple unique way to manage breadcrumb. You don't have several option just one and just one way to do ! That's simple isn't ?

Build Status

Installation

####Step 1 :

  • require fabz29/breadcrumb-bundle

Step 2 : Add the bundle to your AppKernel.php

// config/bundles.php
    ...
    Fabz29\BreadcrumbBundle\Fabz29BreadcrumbBundle::class => ['all' => true],

Step 3 : Configure the bundle

// config/packages/fabz29_breadcrumb.yaml
fabz29_breadcrumb:
    template: 'default/_breadcrumb.html.twig'
    home_route_name: 'Home'
    home_route: 'homepage'
    home_route_params: []

Step 4 [RECOMMENDED|OPTIONAL] : Overide the template

<ol class="breadcrumb hide-phone p-0 m-0">
    {% for link in breadcrumb.links %}
    <li class="breadcrumb-item">
        <a href="{{ path(link.route, link.routeParams ) }}">{{ link.name|trans({}, 'messages' }}</a>
    </li>
    {% endfor %}
</ol>

How to use it

  • in your controller :

        $breadcrumb = $this->get("fabz29_breadcrumb.breadcrumb.manager");
        $breadcrumb->addItem('Settings', 'user_settings');
  • in your twig template where the fuc* you want :

        {{ fabz29_render_breadcrumb() }}

TODO

  • Allow GET parameters not handle by routing component

License

The bundle is developped by Fabien ZANETTI. Licence MIT