Skip to content

Commit

Permalink
Adds Zurb Foundation Menu Presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kashif Ullah committed Aug 24, 2017
1 parent 71a5fb4 commit 0a7d188
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'sidebar' => \Nwidart\Menus\Presenters\Bootstrap\SidebarMenuPresenter::class,
'navmenu' => \Nwidart\Menus\Presenters\Bootstrap\NavMenuPresenter::class,
'adminlte' => \Nwidart\Menus\Presenters\Admin\AdminltePresenter::class,
'zurbmenu' => \Nwidart\Menus\Presenters\Foundation\ZurbMenuPresenter::class,
],

'ordering' => false,
Expand Down
76 changes: 76 additions & 0 deletions src/Presenters/Foundation/ZurbMenuPresenter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace Nwidart\Menus\Presenters\Foundation;

use Nwidart\Menus\Presenters\Presenter;

class ZurbMenuPresenter extends Presenter
{
/**
* {@inheritdoc }
*/
public function getOpenTagWrapper()
{
return PHP_EOL . '<nav class="custom-main">
<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;
}
}

0 comments on commit 0a7d188

Please sign in to comment.