Skip to content

Instantly share code, notes, and snippets.

@ikashifullah
Last active August 24, 2017 09:30
Show Gist options
  • Save ikashifullah/c0eb423bf17797d0be0e2234948f3fd4 to your computer and use it in GitHub Desktop.
Save ikashifullah/c0eb423bf17797d0be0e2234948f3fd4 to your computer and use it in GitHub Desktop.
Zurb Foundation Responsive Navigation Presenter for Laravel-Menu and AsgardCMS
<?php
namespace app\Http\Presenters;
use Nwidart\Menus\Presenters\Presenter;
class ZurbMenuDesktopPresenter extends Presenter
{
/**
* {@inheritdoc }
*/
public function getOpenTagWrapper()
{
return PHP_EOL . '<nav class="custom-main hidden-xs hidden-sm">
<ul class="dropdown menu" data-dropdown-menu>' . PHP_EOL;
}
/**
* {@inheritdoc }
*/
public function getCloseTagWrapper()
{
return PHP_EOL . '</ul></nav>' . PHP_EOL;
}
/**
* {@inheritdoc }
*/
public function getMenuWithoutDropdownWrapper($item)
{
return '<li'.$this->getActiveState($item).'><a href="'. $item->getUrl() .'">'.$item->title.'</a></li>';
}
/**
* {@inheritdoc }
*/
public function getActiveState($item)
{
return \Request::is($item->getRequest()) ? ' class="is-active"' : null;
}
/**
* {@inheritdoc }
*/
public function getDividerWrapper()
{
return '<li class="divider"></li>';
}
/**
* {@inheritdoc }
*/
public function getMenuWithDropDownWrapper($item)
{
return '<li class="dropdown dropdown-primary">
<a class="dropdown-toggle" href="#">'.$item->title.'</a>
<ul class="menu">
'.$this->getChildMenuItems($item).'
</ul>
</li>' . PHP_EOL;
}
/**
* {@inheritdoc }
*/
public function getMultiLevelDropdownWrapper($item)
{
return '<li>
<a href="#">'.$item->title . '</a>
<ul class="menu">
' . $this->getChildMenuItems($item) . '
</ul>
</li>'. PHP_EOL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment