Elgg
Version master
|
Public Member Functions | |
__construct ($name, $text, $href) | |
constructor More... | |
setData ($key, $value=null) | |
Set a data key/value pair or a set of key/value pairs. More... | |
getData ($key) | |
Get stored data. More... | |
setName ($name) | |
Set the identifier of the menu item. More... | |
getName () | |
Get the identifier of the menu item. More... | |
setText ($text) | |
Set the display text of the menu item. More... | |
getText () | |
Get the display text of the menu item. More... | |
setHref ($href) | |
Set the URL of the menu item. More... | |
getHref () | |
Get the URL of the menu item. More... | |
setContext ($contexts) | |
Set the contexts that this menu item is available for. More... | |
getContext () | |
Get an array of context strings. More... | |
inContext ($context= '') | |
Should this menu item be used given the current context. More... | |
setSelected ($state=true) | |
Set the selected flag. More... | |
getSelected () | |
Get selected state. More... | |
setTooltip ($text) | |
Set the tool tip text. More... | |
getTooltip () | |
Get the tool tip text. More... | |
setConfirmText ($text) | |
Set the confirm text shown when link is clicked. More... | |
getConfirmText () | |
Get the confirm text. More... | |
setLinkClass ($class) | |
Set the anchor class. More... | |
getLinkClass () | |
Get the anchor classes as text. More... | |
addLinkClass ($class) | |
Add a link class. More... | |
setDeps ($modules) | |
Set required ES modules. More... | |
getDeps () | |
Get required ES modules. More... | |
addDeps ($modules) | |
Add required ES modules. More... | |
setChildMenuOptions (array $options=[]) | |
Set child menu options for a parent item. More... | |
getChildMenuOptions () | |
Returns child menu options for parent items. More... | |
setItemClass ($class) | |
Set the li classes. More... | |
getItemClass () | |
Get the li classes as text. More... | |
addItemClass ($class) | |
Add a li class. More... | |
setPriority (int $priority) | |
Set the priority of the menu item. More... | |
getPriority () | |
Get the priority of the menu item. More... | |
setSection ($section) | |
Set the section identifier. More... | |
getSection () | |
Get the section identifier. More... | |
setParentName ($name) | |
Set the parent identifier. More... | |
getParentName () | |
Get the parent identifier. More... | |
setParent ($parent) | |
Set the parent menu item. More... | |
getParent () | |
Get the parent menu item. More... | |
addChild ($item) | |
Add a child menu item. More... | |
setChildren ($children) | |
Set the menu item's children. More... | |
getChildren () | |
Get the children menu items. More... | |
sortChildren ($sortFunction) | |
Sort the children. More... | |
getValues () | |
Get all the values for this menu item. More... | |
getID () | |
Get unique item identifier within a collection. More... | |
setItemContentsView (string $view_name) | |
Set the item contents view. More... | |
getItemContentsView () | |
Get the item contents view. More... | |
hasItemContentsView () | |
Check if the menu items has a contents view set. More... | |
Static Public Member Functions | |
static | factory (array $options) |
Create an ElggMenuItem from an associative array. More... | |
Protected Member Functions | |
addClass (array &$current, $additional) | |
Add additional classes. More... | |
Protected Attributes | |
$data | |
$text | |
$href = null | |
$title = false | |
$confirm = '' | |
Elgg Menu Item.
To create a menu item that is not a link, pass false for $href.
Any undocumented properties set will be passed to the output/url view during rendering. E.g. to give a menu item a "target" attribute, set $item->target, or include a "target" key in the options array for factory().
Definition at line 14 of file ElggMenuItem.php.
ElggMenuItem::__construct | ( | $name, | |
$text, | |||
$href | |||
) |
constructor
string | $name | Identifier of the menu item |
string | $text | Display text of the menu item (HTML) |
string | $href | URL of the menu item (false if not a link) |
Definition at line 90 of file ElggMenuItem.php.
ElggMenuItem::addChild | ( | $item | ) |
Add a child menu item.
\ElggMenuItem | $item | A child menu item |
Definition at line 633 of file ElggMenuItem.php.
|
protected |
Add additional classes.
array | $current | The current array of classes |
mixed | $additional | Additional classes (either array of string) |
Definition at line 532 of file ElggMenuItem.php.
ElggMenuItem::addDeps | ( | $modules | ) |
Add required ES modules.
string[]|string | $modules One or more required ES modules |
Definition at line 455 of file ElggMenuItem.php.
ElggMenuItem::addItemClass | ( | $class | ) |
Add a li class.
mixed | $class | An array of class names, or a single string class name. |
Definition at line 520 of file ElggMenuItem.php.
ElggMenuItem::addLinkClass | ( | $class | ) |
Add a link class.
mixed | $class | An array of class names, or a single string class name. |
Definition at line 421 of file ElggMenuItem.php.
|
static |
Create an ElggMenuItem from an associative array.
Required keys are name, text, and href.
Commonly used params: name => STR Menu item identifier (required) text => STR Menu item display text as HTML (required) href => STR Menu item URL (required) false = do not create a link. null = current URL. "" = current URL. "/" = site home page.
section => STR Menu section identifier link_class => STR A class or classes for the tag item_class => STR A class or classes for the tag parent_name => STR Identifier of the parent menu item contexts => ARR Page context strings title => STR Menu item tooltip selected => BOOL Is this menu item currently selected? confirm => STR If set, the link will be drawn with the output/confirmlink view instead of output/url. deps => ARR ES modules required by this menu item child_menu => ARR Options for the child menu data => ARR Custom attributes stored in the menu item.
array | $options | Option array of key value pairs |
Definition at line 130 of file ElggMenuItem.php.
ElggMenuItem::getChildMenuOptions | ( | ) |
Returns child menu options for parent items.
Definition at line 476 of file ElggMenuItem.php.
ElggMenuItem::getChildren | ( | ) |
ElggMenuItem::getConfirmText | ( | ) |
ElggMenuItem::getContext | ( | ) |
ElggMenuItem::getData | ( | $key | ) |
Get stored data.
string | $key | The key for the requested key/value pair |
Definition at line 208 of file ElggMenuItem.php.
ElggMenuItem::getDeps | ( | ) |
ElggMenuItem::getHref | ( | ) |
Get the URL of the menu item.
Definition at line 267 of file ElggMenuItem.php.
ElggMenuItem::getID | ( | ) |
Get unique item identifier within a collection.
Implements Elgg\Collections\CollectionItemInterface.
Definition at line 697 of file ElggMenuItem.php.
ElggMenuItem::getItemClass | ( | ) |
ElggMenuItem::getItemContentsView | ( | ) |
Get the item contents view.
Definition at line 719 of file ElggMenuItem.php.
ElggMenuItem::getLinkClass | ( | ) |
ElggMenuItem::getName | ( | ) |
ElggMenuItem::getParent | ( | ) |
ElggMenuItem::getParentName | ( | ) |
ElggMenuItem::getPriority | ( | ) |
Get the priority of the menu item.
Implements Elgg\Collections\CollectionItemInterface.
Definition at line 556 of file ElggMenuItem.php.
ElggMenuItem::getSection | ( | ) |
ElggMenuItem::getSelected | ( | ) |
ElggMenuItem::getText | ( | ) |
Get the display text of the menu item.
Definition at line 247 of file ElggMenuItem.php.
ElggMenuItem::getTooltip | ( | ) |
ElggMenuItem::getValues | ( | ) |
Get all the values for this menu item.
Useful for rendering.
Definition at line 685 of file ElggMenuItem.php.
ElggMenuItem::hasItemContentsView | ( | ) |
Check if the menu items has a contents view set.
Definition at line 729 of file ElggMenuItem.php.
ElggMenuItem::inContext | ( | $context = '' | ) |
Should this menu item be used given the current context.
string | $context | A context string (default is empty string for current context stack). |
Definition at line 303 of file ElggMenuItem.php.
ElggMenuItem::setChildMenuOptions | ( | array | $options = [] | ) |
Set child menu options for a parent item.
array | $options | Options |
Definition at line 467 of file ElggMenuItem.php.
ElggMenuItem::setChildren | ( | $children | ) |
Set the menu item's children.
ElggMenuItem[] | $children Array of items |
Definition at line 646 of file ElggMenuItem.php.
ElggMenuItem::setConfirmText | ( | $text | ) |
Set the confirm text shown when link is clicked.
string | $text | The text to show |
Definition at line 377 of file ElggMenuItem.php.
ElggMenuItem::setContext | ( | $contexts | ) |
Set the contexts that this menu item is available for.
array | $contexts | An array of context strings. Use 'all' to match all contexts. |
Definition at line 278 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.
mixed | $key | String key or an associative array of key/value pairs |
mixed | $value | The value if $key is a string |
Definition at line 193 of file ElggMenuItem.php.
ElggMenuItem::setDeps | ( | $modules | ) |
Set required ES modules.
string[]|string | $modules One or more required ES modules |
Definition at line 432 of file ElggMenuItem.php.
ElggMenuItem::setHref | ( | $href | ) |
Set the URL of the menu item.
string | $href | URL or false if not a link |
Definition at line 258 of file ElggMenuItem.php.
ElggMenuItem::setItemClass | ( | $class | ) |
Set the li classes.
mixed | $class | An array of class names, or a single string class name. |
Definition at line 487 of file ElggMenuItem.php.
ElggMenuItem::setItemContentsView | ( | string | $view_name | ) |
Set the item contents view.
string | $view_name | the name of the output view |
Definition at line 709 of file ElggMenuItem.php.
ElggMenuItem::setLinkClass | ( | $class | ) |
Set the anchor class.
mixed | $class | An array of class names, or a single string class name. |
Definition at line 397 of file ElggMenuItem.php.
ElggMenuItem::setName | ( | $name | ) |
Set the identifier of the menu item.
string | $name | Unique identifier |
Definition at line 219 of file ElggMenuItem.php.
ElggMenuItem::setParent | ( | $parent | ) |
Set the parent menu item.
\ElggMenuItem | $parent | The parent of this menu item |
Definition at line 609 of file ElggMenuItem.php.
ElggMenuItem::setParentName | ( | $name | ) |
Set the parent identifier.
string | $name | The identifier of the parent |
Definition at line 587 of file ElggMenuItem.php.
ElggMenuItem::setPriority | ( | int | $priority | ) |
Set the priority of the menu item.
int | $priority | The smaller numbers mean higher priority (1 before 100) |
Definition at line 547 of file ElggMenuItem.php.
ElggMenuItem::setSection | ( | $section | ) |
Set the section identifier.
string | $section | The identifier of the section |
Definition at line 567 of file ElggMenuItem.php.
ElggMenuItem::setSelected | ( | $state = true | ) |
Set the selected flag.
bool | $state | Selected state (default is true) |
Definition at line 328 of file ElggMenuItem.php.
ElggMenuItem::setText | ( | $text | ) |
Set the display text of the menu item.
string | $text | The display text as HTML |
Definition at line 238 of file ElggMenuItem.php.
ElggMenuItem::setTooltip | ( | $text | ) |
Set the tool tip text.
string | $text | The text of the tool tip |
Definition at line 357 of file ElggMenuItem.php.
ElggMenuItem::sortChildren | ( | $sortFunction | ) |
Sort the children.
callable | $sortFunction | A function that is passed to usort() |
Definition at line 670 of file ElggMenuItem.php.
|
protected |
Definition at line 81 of file ElggMenuItem.php.
|
protected |
Definition at line 19 of file ElggMenuItem.php.
|
protected |
Definition at line 71 of file ElggMenuItem.php.
|
protected |
Definition at line 66 of file ElggMenuItem.php.
|
protected |
Definition at line 76 of file ElggMenuItem.php.