Breadcrumbs

Render breadcrumbs in your Pagekit site

Breadcrumbs

The breadcrumbs widget renders the current menu path in a breadcrumb.

Features

  • Automatic menu tree rendering
  • Possibility for extensions to add items to the path
  • Google Itemproperties for SEO optimization

Pagekit developers

To add items to the breadcrumbs, simply do so in your controller when preparing the view:

if ($breadcrumbs = App::module('bixie/breadcrumbs')) {

    $breadcrumbs->addUrl([
        'title' => 'My item',
        'url' => '/sub/sub/my-item'
    ]);

}

An example for adding a category tree to the breadcrumbs

if ($breadcrumbs = App::module('bixie/breadcrumbs')) {

    $crumbs = [['title' => $category->title, 'url' => $category->getUrl()]];
    while ($parent_id = $category->parent_id) {
        if ($category = $category->find($parent_id, true)) {
            $crumbs[] = ['title' => $category->title, 'url' => $category->getUrl()];
        }
    }
    foreach (array_reverse($crumbs) as $data) {
        $breadcrumbs->addUrl($data);
    }
}
Date
March 19 2016
Version
0.9.0
Extensions