Methods summary
public
|
#
__construct( string $name, string $text, string $href )
ElggMenuItem constructor
Parameters
- $name
string $name Identifier of the menu item
- $text
string $text Display text of the menu item
- $href
string $href URL of the menu item (false if not a link)
|
public static
ElggMenuItem
|
#
factory( array $options )
ElggMenuItem factory method
ElggMenuItem factory method
This static method creates an ElggMenuItem from an associative array.
Required keys are name, text, and href.
Parameters
- $options
array $options Option array of key value pairs
Returns
|
public
|
#
setData( mixed $key, mixed $value = null )
Set a data key/value pair or a set of key/value pairs
Set a data key/value pair or a set of key/value pairs
This method allows storage of arbitrary data with this menu item. The data
can be used for sorting, custom rendering, or any other use.
Parameters
- $key
mixed $key String key or an associative array of key/value pairs
- $value
mixed $value The value if $key is a string
|
public
mixed
|
#
getData( string $key )
Get stored data
Parameters
- $key
string $key The key for the requested key/value pair
Returns
mixed
|
public
|
#
setName( string $name )
Set the identifier of the menu item
Set the identifier of the menu item
Parameters
- $name
string $name Unique identifier
|
public
string
|
#
getName( )
Get the identifier of the menu item
Get the identifier of the menu item
Returns
string
|
public
|
#
setText( string $text )
Set the display text of the menu item
Set the display text of the menu item
Parameters
- $text
string $text The display text
|
public
string
|
#
getText( )
Get the display text of the menu item
Get the display text of the menu item
Returns
string
|
public
|
#
setHref( string $href )
Set the URL of the menu item
Set the URL of the menu item
Parameters
- $href
string $href URL or false if not a link
|
public
string
|
#
getHref( )
Get the URL of the menu item
Get the URL of the menu item
Returns
string
|
public
|
#
setContext( array $contexts )
Set the contexts that this menu item is available for
Set the contexts that this menu item is available for
Parameters
- $contexts
array $contexts An array of context strings
|
public
array
|
#
getContext( )
Get an array of context strings
Get an array of context strings
Returns
array
|
public
boolean
|
#
inContext( string $context = '' )
Should this menu item be used given the current context
Should this menu item be used given the current context
Parameters
- $context
string $context A context string (default is empty string for current context stack).
Returns
boolean
|
public
|
#
setSelected( boolean $state = true )
Set the selected flag
Parameters
- $state
boolean $state Selected state (default is true)
|
public
boolean
|
|
public
|
#
setTooltip( string $text )
Set the tool tip text
Parameters
- $text
string $text The text of the tool tip
|
public
string
|
|
public
|
#
setConfirmText( string $text )
Set the confirm text shown when link is clicked
Set the confirm text shown when link is clicked
Parameters
- $text
string $text The text to show
|
public
string
|
|
public
|
#
setLinkClass( mixed $class )
Set the anchor class
Parameters
- $class
mixed $class An array of class names, or a single string class name.
|
public
string
|
#
getLinkClass( )
Get the anchor classes as text
Get the anchor classes as text
Returns
string
|
public
|
#
addLinkClass( mixed $class )
Add a link class
Parameters
- $class
mixed $class An array of class names, or a single string class name.
|
public
|
#
setItemClass( mixed $class )
Set the li classes
Parameters
- $class
mixed $class An array of class names, or a single string class name.
|
public
string
|
#
getItemClass( )
Get the li classes as text
Get the li classes as text
Returns
string
|
public
|
#
setPriority( integer $priority )
Set the priority of the menu item
Set the priority of the menu item
Parameters
- $priority
integer $priority The smaller numbers mean higher priority (1 before 100)
|
public
integer
|
#
getPriority( )
Get the priority of the menu item
Get the priority of the menu item
Returns
integer
|
public
|
#
setSection( string $section )
Set the section identifier
Set the section identifier
Parameters
- $section
string $section The identifier of the section
|
public
string
|
#
getSection( )
Get the section identifier
Get the section identifier
Returns
string
|
public
|
#
setParentName( string $name )
Set the parent identifier
Set the parent identifier
Parameters
- $name
string $name The identifier of the parent ElggMenuItem
|
public
string
|
#
getParentName( )
Get the parent identifier
Get the parent identifier
Returns
string
|
public
|
|
public
ElggMenuItem
|
|
public
|
|
public
|
#
setChildren( array $children )
Set the menu item's children
Set the menu item's children
Parameters
- $children
array $children Array of ElggMenuItems
|
public
array
|
#
getChildren( )
Get the children menu items
Get the children menu items
Returns
array
|
public
|
#
sortChildren( string $sortFunction )
Sort the children
Parameters
- $sortFunction
string $sortFunction A function that is passed to usort()
|
public
string
|
#
getContent( array $vars = array() )
Get the menu item content (usually a link)
Get the menu item content (usually a link)
Parameters
- $vars
array $vars Options to pass to output/url if a link
Returns
string
|