1. Go to this page and download the library: Download darkling/nette-menu library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
darkling / nette-menu example snippets
namespace App;
use Carrooi\Menu\UI\IMenuComponentFactory;
use Carrooi\Menu\UI\MenuComponent;
use Nette\Application\UI\Presenter;
final class BasePresenter extends Presenter
{
private $menuFactory;
public function injectBasePresenter(IMenuComponentFactory $menuFactory)
{
$this->menuFactory = $menuFactory;
}
protected function createComponentMenu(): MenuComponent
{
return $this->menuFactory->create('front');
}
}
namespace App;
use Carrooi\Menu\IMenuItem;
use Carrooi\Menu\Security\IAuthorizator;
final class FrontAuthorizator implements IAuthorizator
{
public function isMenuItemAllowed(IMenuItem $item): bool
{
return isItemAllowed($item);
}
}
namespace App;
use Carrooi\Menu\IMenuItem;
use Carrooi\Menu\LinkGenerator\ILinkGenerator;
final class FrontLinkGenerator implements ILinkGenerator
{
public function link(IMenuItem $item): string
{
return generateLink($item);
}
}
html
{control menu} <!-- display menu -->
{control menu:breadcrumbs} <!-- display breadcrumbs -->
{control menu:sitemap} <!-- display sitemap -->
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.