62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\CMS\MenuPresenters;
|
|
|
|
use Nwidart\Menus\Presenters\Presenter;
|
|
|
|
class FoundationDropdownMenuPresenter extends Presenter
|
|
{
|
|
/**
|
|
* {@inheritdoc }
|
|
*/
|
|
public function getOpenTagWrapper()
|
|
{
|
|
return PHP_EOL . '<ul class="vertical dropdown menu" data-dropdown-menu>' . PHP_EOL;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc }
|
|
*/
|
|
public function getCloseTagWrapper()
|
|
{
|
|
return PHP_EOL . '</ul>' . PHP_EOL;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc }
|
|
*/
|
|
public function getMenuWithoutDropdownWrapper($item)
|
|
{
|
|
$link = '<a href="' . $item->getUrl() . '">' . $item->getIcon() . ' ' . $item->title . '</a>';
|
|
return '<li' . $this->getActiveState($item) . '>' . $link . '</li>' . PHP_EOL;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc }
|
|
*/
|
|
public function getActiveState($item)
|
|
{
|
|
return \Request::is($item->getRequest()) || $item->hasActiveOnChild ? ' class="active"' : null;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc }
|
|
*/
|
|
public function getDividerWrapper()
|
|
{
|
|
return '<li class="divider"></li>' . PHP_EOL;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc }
|
|
*/
|
|
public function getMenuWithDropDownWrapper($item)
|
|
{
|
|
return '<li>
|
|
<a href="#">' . $item->getIcon() . ' ' . $item->title . '</a>
|
|
<ul class="vertical menu">
|
|
' . $this->getChildMenuItems($item) . '
|
|
</ul>
|
|
</li>' . PHP_EOL;
|
|
}
|
|
} |