Basic component rendering breadcrumb for websites using Nette Framework.
Included template is compatible with Bootstrap 3.2 *
This package requires PHP 5.4.
The best way to install this package is using Composer:
$ composer require "rikiless/breadcrumb-component:@dev"
And register the factory in config.neon
:
services:
- Rikiless\BreadcrumbComponent\IControl
Inject to presenter:
class Presenter ...
{
/**
* @var Rikiless\BreadcrumbComponent\IControl
* @inject
*/
public $breadcrumbControl;
public function createComponentBreadcrumb()
{
return $this->breadcrumbControl->create();
}
}
Render in template:
{control breadcrumb}
class CatalogPresenter ...
{
public function actionEpisode($id)
{
//$episode = ...($id);
$this['breadcrumb']
->add('Series', $this->link('Homepage:genres'))
->add($episode->show->name, $this->link('Homepage:show', $episode->show->url))
->add('All episodes', $this->link('Homepage:episodes', $episode->show->url))
->add($episode->show->name);
}
}
You can use your own template by this way:
class Presenter ...
{
public function createComponentBreadcrumb()
{
$breadcrumb = $this->breadcrumbControl->create();
$breadcrumb->setTemplate(__DIR__. '/../templates/_breadcrumb.latte');
return $breadcrumb;
}
}
Translations are supported.
* In default template is use of classes .visible-sm
mixed with .visible-lg
and it seems to be broken in Bootstrap 3.1.