ElggMenuItem Class Reference

List of all members.

Public Member Functions

 __construct ($name, $text, $href)
 ElggMenuItem constructor.
 setData ($key, $value=null)
 Set a data key/value pair or a set of key/value pairs.
 getData ($key)
 Get stored data.
 setName ($name)
 Set the identifier of the menu item.
 getName ()
 Get the identifier of the menu item.
 setText ($text)
 Set the display text of the menu item.
 getText ()
 Get the display text of the menu item.
 setHref ($href)
 Set the URL of the menu item.
 getHref ()
 Get the URL of the menu item.
 setContext ($contexts)
 Set the contexts that this menu item is available for.
 getContext ()
 Get an array of context strings.
 inContext ($context= '')
 Should this menu item be used given the current context.
 setSelected ($state=true)
 Set the selected flag.
 getSelected ()
 Get selected state.
 setTooltip ($text)
 Set the tool tip text.
 getTooltip ()
 Get the tool tip text.
 setConfirmText ($text)
 Set the confirm text shown when link is clicked.
 getConfirmText ()
 Get the confirm text.
 setLinkClass ($class)
 Set the anchor class.
 getLinkClass ()
 Get the anchor classes as text.
 addLinkClass ($class)
 Add a link class.
 setItemClass ($class)
 Set the li classes.
 getItemClass ()
 Get the li classes as text.
 setWeight ($priority)
 Set the priority of the menu item.
 getWeight ()
 Get the priority of the menu item.
 setPriority ($priority)
 Set the priority of the menu item.
 getPriority ()
 Get the priority of the menu item.
 setSection ($section)
 Set the section identifier.
 getSection ()
 Get the section identifier.
 setParentName ($name)
 Set the parent identifier.
 getParentName ()
 Get the parent identifier.
 setParent ($parent)
 Set the parent menu item.
 getParent ()
 Get the parent menu item.
 addChild ($item)
 Add a child menu item.
 setChildren ($children)
 Set the menu item's children.
 getChildren ()
 Get the children menu items.
 sortChildren ($sortFunction)
 Sort the children.
 getContent (array $vars=array())
 Get the menu item content (usually a link).

Static Public Member Functions

static factory ($options)
 ElggMenuItem factory method.

Protected Attributes

 $data
 $text
 $href = null
 $title = false
 $confirm = ''

Detailed Description

Definition at line 11 of file ElggMenuItem.php.


Constructor & Destructor Documentation

ElggMenuItem::__construct ( name,
text,
href 
)

ElggMenuItem constructor.

Parameters:
string $name Identifier of the menu item
string $text Display text of the menu item
string $href URL of the menu item (false if not a link)

Definition at line 76 of file ElggMenuItem.php.


Member Function Documentation

ElggMenuItem::addChild ( item  ) 

Add a child menu item.

Parameters:
ElggMenuItem $item A child menu item
Returns:
void

Definition at line 515 of file ElggMenuItem.php.

ElggMenuItem::addLinkClass ( class  ) 

Add a link class.

Parameters:
mixed $class An array of class names, or a single string class name.
Returns:
void

Definition at line 370 of file ElggMenuItem.php.

static ElggMenuItem::factory ( options  )  [static]

ElggMenuItem factory method.

This static method creates an ElggMenuItem from an associative array. Required keys are name, text, and href.

Parameters:
array $options Option array of key value pairs
Returns:
ElggMenuItem or NULL on error

Definition at line 98 of file ElggMenuItem.php.

ElggMenuItem::getChildren (  ) 

Get the children menu items.

Returns:
array

Definition at line 534 of file ElggMenuItem.php.

ElggMenuItem::getConfirmText (  ) 

Get the confirm text.

Returns:
string

Definition at line 337 of file ElggMenuItem.php.

ElggMenuItem::getContent ( array $  vars = array()  ) 

Get the menu item content (usually a link).

Parameters:
array $vars Options to pass to output/url if a link
Returns:
string

Definition at line 558 of file ElggMenuItem.php.

ElggMenuItem::getContext (  ) 

Get an array of context strings.

Returns:
array

Definition at line 256 of file ElggMenuItem.php.

ElggMenuItem::getData ( key  ) 

Get stored data.

Parameters:
string $key The key for the requested key/value pair
Returns:
mixed

Definition at line 173 of file ElggMenuItem.php.

ElggMenuItem::getHref (  ) 

Get the URL of the menu item.

Returns:
string

Definition at line 234 of file ElggMenuItem.php.

ElggMenuItem::getItemClass (  ) 

Get the li classes as text.

Returns:
string

Definition at line 397 of file ElggMenuItem.php.

ElggMenuItem::getLinkClass (  ) 

Get the anchor classes as text.

Returns:
string

Definition at line 360 of file ElggMenuItem.php.

ElggMenuItem::getName (  ) 

Get the identifier of the menu item.

Returns:
string

Definition at line 196 of file ElggMenuItem.php.

ElggMenuItem::getParent (  ) 

Get the parent menu item.

Returns:
ElggMenuItem or null

Definition at line 505 of file ElggMenuItem.php.

ElggMenuItem::getParentName (  ) 

Get the parent identifier.

Returns:
string

Definition at line 486 of file ElggMenuItem.php.

ElggMenuItem::getPriority (  ) 

Get the priority of the menu item.

Returns:
int

Definition at line 448 of file ElggMenuItem.php.

ElggMenuItem::getSection (  ) 

Get the section identifier.

Returns:
string

Definition at line 467 of file ElggMenuItem.php.

ElggMenuItem::getSelected (  ) 

Get selected state.

Returns:
bool

Definition at line 299 of file ElggMenuItem.php.

ElggMenuItem::getText (  ) 

Get the display text of the menu item.

Returns:
string

Definition at line 215 of file ElggMenuItem.php.

ElggMenuItem::getTooltip (  ) 

Get the tool tip text.

Returns:
string

Definition at line 318 of file ElggMenuItem.php.

ElggMenuItem::getWeight (  ) 

Get the priority of the menu item.

Returns:
int

Definition at line 429 of file ElggMenuItem.php.

ElggMenuItem::inContext ( context = ''  ) 

Should this menu item be used given the current context.

Parameters:
string $context A context string (default is empty string for current context stack).
Returns:
bool

Definition at line 267 of file ElggMenuItem.php.

ElggMenuItem::setChildren ( children  ) 

Set the menu item's children.

Parameters:
array $children Array of ElggMenuItems
Returns:
void

Definition at line 525 of file ElggMenuItem.php.

ElggMenuItem::setConfirmText ( text  ) 

Set the confirm text shown when link is clicked.

Parameters:
string $text The text to show
Returns:
void

Definition at line 328 of file ElggMenuItem.php.

ElggMenuItem::setContext ( contexts  ) 

Set the contexts that this menu item is available for.

Parameters:
array $contexts An array of context strings
Returns:
void

Definition at line 244 of file ElggMenuItem.php.

ElggMenuItem::setData ( key,
value = null 
)

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:
mixed $key String key or an associative array of key/value pairs
mixed $value The value if $key is a string
Returns:
void

Definition at line 159 of file ElggMenuItem.php.

ElggMenuItem::setHref ( href  ) 

Set the URL of the menu item.

Parameters:
string $href URL or false if not a link
Returns:
void

Definition at line 225 of file ElggMenuItem.php.

ElggMenuItem::setItemClass ( class  ) 

Set the li classes.

Parameters:
mixed $class An array of class names, or a single string class name.
Returns:
void

Definition at line 384 of file ElggMenuItem.php.

ElggMenuItem::setLinkClass ( class  ) 

Set the anchor class.

Parameters:
mixed $class An array of class names, or a single string class name.
Returns:
void

Definition at line 347 of file ElggMenuItem.php.

ElggMenuItem::setName ( name  ) 

Set the identifier of the menu item.

Parameters:
string $name Unique identifier
Returns:
void

Definition at line 187 of file ElggMenuItem.php.

ElggMenuItem::setParent ( parent  ) 

Set the parent menu item.

Parameters:
ElggMenuItem $parent The parent of this menu item
Returns:
void

Definition at line 496 of file ElggMenuItem.php.

ElggMenuItem::setParentName ( name  ) 

Set the parent identifier.

Parameters:
string $name The identifier of the parent ElggMenuItem
Returns:
void

Definition at line 477 of file ElggMenuItem.php.

ElggMenuItem::setPriority ( priority  ) 

Set the priority of the menu item.

Parameters:
int $priority The smaller numbers mean higher priority (1 before 100)
Returns:
void

Definition at line 439 of file ElggMenuItem.php.

ElggMenuItem::setSection ( section  ) 

Set the section identifier.

Parameters:
string $section The identifier of the section
Returns:
void

Definition at line 458 of file ElggMenuItem.php.

ElggMenuItem::setSelected ( state = true  ) 

Set the selected flag.

Parameters:
bool $state Selected state (default is true)
Returns:
void

Definition at line 290 of file ElggMenuItem.php.

ElggMenuItem::setText ( text  ) 

Set the display text of the menu item.

Parameters:
string $text The display text
Returns:
void

Definition at line 206 of file ElggMenuItem.php.

ElggMenuItem::setTooltip ( text  ) 

Set the tool tip text.

Parameters:
string $text The text of the tool tip
Returns:
void

Definition at line 309 of file ElggMenuItem.php.

ElggMenuItem::setWeight ( priority  ) 

Set the priority of the menu item.

Parameters:
int $priority The smaller numbers mean higher priority (1 before 100)
Returns:
void

Definition at line 419 of file ElggMenuItem.php.

ElggMenuItem::sortChildren ( sortFunction  ) 

Sort the children.

Parameters:
string $sortFunction A function that is passed to usort()
Returns:
void

Definition at line 544 of file ElggMenuItem.php.


Member Data Documentation

ElggMenuItem::$confirm = '' [protected]

Definition at line 66 of file ElggMenuItem.php.

ElggMenuItem::$data [protected]

Definition at line 16 of file ElggMenuItem.php.

ElggMenuItem::$href = null [protected]

Definition at line 56 of file ElggMenuItem.php.

ElggMenuItem::$text [protected]

Definition at line 51 of file ElggMenuItem.php.

ElggMenuItem::$title = false [protected]

Definition at line 61 of file ElggMenuItem.php.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations
Generated on Tue May 21 00:01:19 2013 for Elgg by  doxygen 1.6.3