sasule/breadcrumb

Breadcrumbs component for Nette Framework

v1.1.0 2023-10-06 10:53 UTC

This package is auto-updated.

Last update: 2024-11-06 13:16:59 UTC


README

Breadcrumbs component for Nette Framework (2.x and 3.x branch)

Inspired by Geniv/nette-breadcrumb

Installation

$ composer require sasule/breadcrumb

Usage

First activate extension in your config.neon or common.neon (based on version of Nette framework)

extensions:
    breadcrumb:		Sasule\Breadcrumb\DI\BreadcrumbExtension

Then inject into your presenter and create component:

/**
 * @var Sasule\Breadcrumb\Breadcrumb
 */
private $breadcrumb;

/**
 * @param Sasule\Breadcrumb\Breadcrumb $breadcrumb
 */
public function injectBreadcrumb(Sasule\Breadcrumb\Breadcrumb $breadcrumb)
{
    $this->breadcrumb = $breadcrumb;
}


...

/**
 * @return Sasule\Breadcrumb\Breadcrumb
 */
protected function createComponentBreadcrumb()
{
    $bc = $this->breadcrumb;
    //$bc->addLink('Domů', ':Default:Homepage:default');  //You can add default links so this will be shown everytime (if uncommented).
    return $bc;
}

Then in your template:

{control breadcrumb}

...and you are done.

Methods