Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bcm Breadcrumbbundle Laravel Package

benoitmariaux/bcm-breadcrumbbundle

View on GitHub
Deep Wiki
Context7

BCMBreadcrumbBundle

BCMBreadcrumbBundle allows you to generate breadcrumbs easily for your Symfony project.

Installation

With composer, add:

{
    require: {
        "benoitmariaux/bcm-breadcrumbbundle": "dev-master"
    }
}

Then enable it in your kernel:

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        ...
        new BCM\BreadcrumbBundle\BCMBreadcrumbBundle(),
        ...

Usage

First step : the routes

You have to configure two attributes (label and parent) to defaults in routes you want to add to your breadcrumb :

homepage:
    pattern: /
    defaults:
        _controller: AcmeDemoBundle:Default:home
        label: homepage # no parent for homepage

articles:
    pattern: /articles
    defaults:
        _controller: AcmeDemoBundle:Article:list
        label: ARTICLES
        parent: homepage

article:
    pattern: /articles/show/{article_id}
    defaults:
        _controller: AcmeDemoBundle:Article:article
        label: '{article_title}'
        parent: articles

Second step : the controller

Inject all parameters you need for current breadcrumb routes and labels

$breadcrumb = $this->get('bcm_breadcrumb.manager')->render(array(
    'article_title' => $article->getTitle(), // useful for article route label
    'article_id' => $article->getId() // useful for article route pattern
));

return $this->render('AcmeDemoBundle:Default:article.html.twig', array(
    'article' => $article,
    'breadcrumb' => $breadcrumb
));

Last step : the view

{{ breadcrumb|raw }}

Your own view

The default view is: vendor/benoitmariaux/bcm-breadcrumbbundle/BCM/BreadcrumbBundle/Resources/views/bcm-breadcrumb.html.twig

You can overwrite it by creating your own here: app/Resources/BCMBreadcrumbBundle/views/bcm-breadcrumb.html.twig

Label translation

You can define translations for your labels with the default domain breadcrumb:

  • breadcrumb.fr.xliff
  • breadcrumb.de.xliff
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style