PHP Class Devise\Menus\MenusRepository

Afficher le fichier Open project: devisephp/cms

Méthodes publiques

Méthode Description
__construct ( DvsMenu $Menu, DvsMenuItem $MenuItem, LanguageDetector $LanguageDetector, UserHelper $UserHelper, Framework $Framework )
buildMenu ( $name, integer $depth = 2, null $page = null ) : mixed Build a menu from it's name
findById ( $id ) : DvsMenu Finds DvsMenu by an integer id
findMenuByName ( string $name ) : array Find menu using name value
getChildrenMenuItems ( $name ) : array Get the children menu items of a menu name
getSiblingMenuItems ( $name ) : array Get menu siblings
menuStructure ( DvsMenu | DvsMenuItem $menu, boolean $isRootMenu = true ) : array A simple way to view the menu structure not in use by anything right now but here for troubleshooting menus if we need to
menus ( ) : Collection Returns a Collection of DvsMenus

Private Methods

Méthode Description
checkMenuItemPermission ( $permission ) : boolean Tells us whether or not the menu item is supposed to be shown to this user
childrenLoaded ( MenuItem $item ) : boolean checks if the children relation has been lazy loaded the goal is to respect the 'depth' value requested when the menu was built
getAllowedMenuItems ( DvsMenuItem $menuItem ) : DvsMenuItem | false This will let us know if the menu item is allowed and it also traverses all it's children (and future generations) filtering out menu items that are not allowed
getAllowedMenuItemsFromMenu ( DvsMenu $menu ) : Collection This gets us all the allowed menu items from a particular menu.
getLazyLoadByDepth ( $startingRelation, $depth ) : string generates the lazy load string based off the requested depth
getTranslation ( $menu ) : mixed Translate the menu if needed
locateCurrentMenuItem ( $pageId, $menuItems ) : boolean recursively traverses the menu items and their children finds the item that matches the current page, marks it as an 'activeItem' and marks it's parents as 'activeAncestor'
traverseMenu ( $menu, $depth, $page ) : mixed Traverses the menu recursively finding sub menus

Method Details

__construct() public méthode

public __construct ( DvsMenu $Menu, DvsMenuItem $MenuItem, LanguageDetector $LanguageDetector, UserHelper $UserHelper, Framework $Framework )
$Menu DvsMenu
$MenuItem DvsMenuItem
$LanguageDetector Devise\Languages\LanguageDetector
$UserHelper Devise\Users\UserHelper
$Framework Devise\Support\Framework

buildMenu() public méthode

Build a menu from it's name
public buildMenu ( $name, integer $depth = 2, null $page = null ) : mixed
$name
$depth integer
$page null
Résultat mixed

findById() public méthode

Finds DvsMenu by an integer id
public findById ( $id ) : DvsMenu
$id
Résultat DvsMenu

findMenuByName() public méthode

Find menu using name value
public findMenuByName ( string $name ) : array
$name string Human readable name of link
Résultat array

getChildrenMenuItems() public méthode

Get the children menu items of a menu name
public getChildrenMenuItems ( $name ) : array
$name
Résultat array

getSiblingMenuItems() public méthode

Get menu siblings
public getSiblingMenuItems ( $name ) : array
$name
Résultat array

menuStructure() public méthode

A simple way to view the menu structure not in use by anything right now but here for troubleshooting menus if we need to
public menuStructure ( DvsMenu | DvsMenuItem $menu, boolean $isRootMenu = true ) : array
$menu DvsMenu | DvsMenuItem
$isRootMenu boolean
Résultat array

menus() public méthode

Returns a Collection of DvsMenus
public menus ( ) : Collection
Résultat Illuminate\Support\Collection