kollarovic/navigation

Navigation for Nette

4.0.1 2023-11-17 11:57 UTC

This package is auto-updated.

Last update: 2024-03-22 11:13:23 UTC


README

composer.json

{
    "require":{
        "kollarovic/navigation": "dev-master"
    }
}

config.neon

extensions:
	navigation: Kollarovic\Navigation\DI\Extension


navigation:
	backend:
		label: Homepage
		link: Homepage:default
		items:
			page:
				label: Page
				link: Page:default
			setting:
				label: Setting
				link: Setting:default
				items:
					base:
						label: Base
						link: Setting:base
					advanced:
						label: Advanced
						link: Setting:advanced
						items:
							web:
								label: Web
								link: Setting:web
							mail:
								label: Mail
								link: Setting:mail

presenter

use Kollarovic\Navigation\ItemsFactory;
use Kollarovic\Navigation\NavigationControl;
use Kollarovic\Navigation\SitemapControl;


abstract class BasePresenter extends Nette\Application\UI\Presenter
{

	/** @var \Kollarovic\Navigation\ItemsFactory @inject */
	public $itemsFactory;


	protected function createComponentNavigation()
	{
		return new NavigationControl($this->itemsFactory->create('backend'));
	}


	protected function createComponentSitemap()
	{
		return new SitemapControl($this->itemsFactory->create('backend'));
	}

}

template.latte

{control navigation:menu}

{control navigation:breadcrumb}

{control navigation:panel}

{control sitemap}