PHP Class ElggMenuBuilder, Elgg

Since: 1.8.0
Afficher le fichier Open project: elgg/elgg Class Usage Examples

Protected Properties

Свойство Type Description
$menu ElggMenuItem[]
$selected

Méthodes publiques

Méthode Description
__construct ( array $menu ) \ElggMenuBuilder constructor
compareByName ( ElggMenuItem $a, ElggMenuItem $b ) : boolean Compare two menu items by their identifiers
compareByPriority ( ElggMenuItem $a, ElggMenuItem $b ) : boolean Compare two menu items by their priority
compareByText ( ElggMenuItem $a, ElggMenuItem $b ) : boolean Compare two menu items by their display text HTML tags are stripped before comparison
getMenu ( mixed $sort_by = 'text' ) : array Get a prepared menu array
getSelected ( ) : ElggMenuItem Get the selected menu item

Méthodes protégées

Méthode Description
findSelected ( ) : ElggMenuItem Find the menu item that is currently selected
selectFromContext ( ) : void Select menu items for the current context
setupSections ( ) : void Group the menu items into sections
setupTrees ( ) : void Create trees for each menu section
sort ( mixed $sort_by ) : void Sort the menu sections and trees

Method Details

__construct() public méthode

\ElggMenuBuilder constructor
public __construct ( array $menu )
$menu array Array of \ElggMenuItem objects

compareByName() public static méthode

Compare two menu items by their identifiers
public static compareByName ( ElggMenuItem $a, ElggMenuItem $b ) : boolean
$a ElggMenuItem Menu item
$b ElggMenuItem Menu item
Résultat boolean

compareByPriority() public static méthode

Compare two menu items by their priority
Since: 1.9.0
public static compareByPriority ( ElggMenuItem $a, ElggMenuItem $b ) : boolean
$a ElggMenuItem Menu item
$b ElggMenuItem Menu item
Résultat boolean

compareByText() public static méthode

Compare two menu items by their display text HTML tags are stripped before comparison
public static compareByText ( ElggMenuItem $a, ElggMenuItem $b ) : boolean
$a ElggMenuItem Menu item
$b ElggMenuItem Menu item
Résultat boolean

findSelected() protected méthode

Find the menu item that is currently selected
protected findSelected ( ) : ElggMenuItem
Résultat ElggMenuItem

getMenu() public méthode

Get a prepared menu array
public getMenu ( mixed $sort_by = 'text' ) : array
$sort_by mixed Method to sort the menu by. @see \ElggMenuBuilder::sort()
Résultat array

getSelected() public méthode

Get the selected menu item
public getSelected ( ) : ElggMenuItem
Résultat ElggMenuItem

selectFromContext() protected méthode

Select menu items for the current context
protected selectFromContext ( ) : void
Résultat void

setupSections() protected méthode

Group the menu items into sections
protected setupSections ( ) : void
Résultat void

setupTrees() protected méthode

Create trees for each menu section
protected setupTrees ( ) : void
Résultat void

sort() protected méthode

Sort the menu sections and trees
protected sort ( mixed $sort_by ) : void
$sort_by mixed Sort type as string or php callback
Résultat void

Property Details

$menu protected_oe property

protected ElggMenuItem[] $menu
Résultat ElggMenuItem[]

$selected protected_oe property

protected $selected