PHP Class Knp\Bundle\MenuBundle\Templating\Helper\MenuHelper

Inheritance: extends Symfony\Component\Templating\Helper\Helper
Afficher le fichier Open project: KnpLabs/KnpMenuBundle Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Knp\Menu\Twig\Helper $helper, Knp\Menu\Matcher\MatcherInterface $matcher, Knp\Menu\Util\MenuManipulator $menuManipulator )
get ( Knp\Menu\ItemInterface | string $menu, array $path = [], array $options = [] ) : Knp\Menu\ItemInterface Retrieves an item following a path in the tree.
getBreadcrumbsArray ( Knp\Menu\ItemInterface | array | string $menu, string | array | null $subItem = null ) : array Returns an array ready to be used for breadcrumbs.
getCurrentItem ( Knp\Menu\ItemInterface | array | string $menu ) : Knp\Menu\ItemInterface | null Returns the current item of a menu.
getName ( ) : string
getPathAsString ( Knp\Menu\ItemInterface $menu, string $separator = ' > ' ) : string A string representation of this menu item
isAncestor ( Knp\Menu\ItemInterface $item, integer $depth = null ) : boolean Checks whether an item is the ancestor of a current item.
isCurrent ( Knp\Menu\ItemInterface $item ) : boolean Checks whether an item is current.
render ( Knp\Menu\ItemInterface | string | array $menu, array $options = [], string $renderer = null ) : string Renders a menu with the specified renderer.

Method Details

__construct() public méthode

public __construct ( Knp\Menu\Twig\Helper $helper, Knp\Menu\Matcher\MatcherInterface $matcher, Knp\Menu\Util\MenuManipulator $menuManipulator )
$helper Knp\Menu\Twig\Helper
$matcher Knp\Menu\Matcher\MatcherInterface
$menuManipulator Knp\Menu\Util\MenuManipulator

get() public méthode

Retrieves an item following a path in the tree.
public get ( Knp\Menu\ItemInterface | string $menu, array $path = [], array $options = [] ) : Knp\Menu\ItemInterface
$menu Knp\Menu\ItemInterface | string
$path array
$options array
Résultat Knp\Menu\ItemInterface

getBreadcrumbsArray() public méthode

Returns an array ready to be used for breadcrumbs.
public getBreadcrumbsArray ( Knp\Menu\ItemInterface | array | string $menu, string | array | null $subItem = null ) : array
$menu Knp\Menu\ItemInterface | array | string
$subItem string | array | null
Résultat array

getCurrentItem() public méthode

Returns the current item of a menu.
public getCurrentItem ( Knp\Menu\ItemInterface | array | string $menu ) : Knp\Menu\ItemInterface | null
$menu Knp\Menu\ItemInterface | array | string
Résultat Knp\Menu\ItemInterface | null

getName() public méthode

public getName ( ) : string
Résultat string

getPathAsString() public méthode

e.g. Top Level 1 > Second Level > This menu
public getPathAsString ( Knp\Menu\ItemInterface $menu, string $separator = ' > ' ) : string
$menu Knp\Menu\ItemInterface
$separator string
Résultat string

isAncestor() public méthode

Checks whether an item is the ancestor of a current item.
public isAncestor ( Knp\Menu\ItemInterface $item, integer $depth = null ) : boolean
$item Knp\Menu\ItemInterface
$depth integer The max depth to look for the item
Résultat boolean

isCurrent() public méthode

Checks whether an item is current.
public isCurrent ( Knp\Menu\ItemInterface $item ) : boolean
$item Knp\Menu\ItemInterface
Résultat boolean

render() public méthode

Renders a menu with the specified renderer.
public render ( Knp\Menu\ItemInterface | string | array $menu, array $options = [], string $renderer = null ) : string
$menu Knp\Menu\ItemInterface | string | array
$options array
$renderer string
Résultat string