This repository has been archived by the owner on Jun 20, 2021. It is now read-only.
forked from composer/packagist
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Packagist\WebBundle\Menu; | ||
|
||
use Knp\Menu\FactoryInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class MenuBuilder | ||
{ | ||
private $factory; | ||
|
||
/** | ||
* @param FactoryInterface $factory | ||
*/ | ||
public function __construct(FactoryInterface $factory) | ||
{ | ||
$this->factory = $factory; | ||
} | ||
|
||
public function createUserMenu() | ||
{ | ||
$menu = $this->factory->createItem('root'); | ||
$menu->setChildrenAttribute('class', 'nav-user-menu'); | ||
|
||
$menu->addChild('Profile', array('label' => '<span class="icon-vcard"></span>Profile', 'route' => 'fos_user_profile_show', 'extras' => array('safe_label' => true))); | ||
$menu->addChild('Settings', array('label' => '<span class="icon-tools"></span>Settings', 'route' => 'fos_user_profile_edit', 'extras' => array('safe_label' => true))); | ||
$menu->addChild('Change password', array('label' => '<span class="icon-key"></span>Change password', 'route' => 'fos_user_change_password', 'extras' => array('safe_label' => true))); | ||
$menu->addChild('My packages', array('label' => '<span class="icon-box"></span>My packages', 'route' => 'user_packages', 'routeParameters' => array('name' => 'stloyd'), 'extras' => array('safe_label' => true))); | ||
$menu->addChild('My favorites', array('label' => '<span class="icon-leaf"></span>My favorites', 'route' => 'user_favorites', 'routeParameters' => array('name' => 'stloyd'), 'extras' => array('safe_label' => true))); | ||
$menu->addChild('hr', array('label' => '<hr>', 'labelAttributes' => array('class' => 'normal'), 'extras' => array('safe_label' => true))); | ||
$menu->addChild('Logout', array('label' => '<span class="icon-off"></span>Logout', 'route' => 'logout', 'extras' => array('safe_label' => true))); | ||
|
||
return $menu; | ||
} | ||
|
||
public function createProfileMenu() | ||
{ | ||
$menu = $this->factory->createItem('root'); | ||
$menu->setChildrenAttribute('class', 'nav nav-tabs nav-stacked'); | ||
|
||
$menu->addChild('Profile', array('label' => '<span class="icon-vcard"></span>Profile', 'route' => 'fos_user_profile_show', 'extras' => array('safe_label' => true))); | ||
$menu->addChild('Edit your information', array('label' => '<span class="icon-tools"></span>Edit your information', 'route' => 'fos_user_profile_edit', 'extras' => array('safe_label' => true))); | ||
$menu->addChild('Change password', array('label' => '<span class="icon-key"></span>Change password', 'route' => 'fos_user_change_password', 'extras' => array('safe_label' => true))); | ||
$menu->addChild('View your packages', array('label' => '<span class="icon-box"></span>View your packages', 'route' => 'user_packages', 'routeParameters' => array('name' => 'stloyd'), 'extras' => array('safe_label' => true))); | ||
$menu->addChild('View your favorites', array('label' => '<span class="icon-leaf"></span>View your favorites', 'route' => 'user_favorites', 'routeParameters' => array('name' => 'stloyd'), 'extras' => array('safe_label' => true))); | ||
|
||
return $menu; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters