PHP Класс ElggMenuItem, Elgg

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().
С версии: 1.8.0
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$confirm The string to display if link is clicked
$data Non-rendered data about the menu item
$href The menu url
$text The menu display string (HTML)
$title Tooltip

Открытые методы

Метод Описание
__construct ( string $name, string $text, string $href ) \ElggMenuItem constructor
addChild ( ElggMenuItem $item ) : void Add a child menu item
addDeps ( string[] | string $modules ) : void Add required AMD modules
addItemClass ( mixed $class ) : void Add a li class
addLinkClass ( mixed $class ) : void Add a link class
factory ( array $options ) : ElggMenuItem Create an ElggMenuItem from an associative array. Required keys are name, text, and href.
getChildren ( ) : ElggMenuItem[] Get the children menu items
getConfirmText ( ) : string Get the confirm text
getContext ( ) : array Get an array of context strings
getData ( string $key ) : mixed Get stored data
getDeps ( ) : string[] Get required AMD modules
getHref ( ) : string Get the URL of the menu item
getItemClass ( ) : string Get the li classes as text
getLinkClass ( ) : string Get the anchor classes as text
getName ( ) : string Get the identifier of the menu item
getParent ( ) : ElggMenuItem Get the parent menu item
getParentName ( ) : string Get the parent identifier
getPriority ( ) : integer Get the priority of the menu item
getSection ( ) : string Get the section identifier
getSelected ( ) : boolean Get selected state
getText ( ) : string Get the display text of the menu item
getTooltip ( ) : string Get the tool tip text
getValues ( ) : array Get all the values for this menu item. Useful for rendering.
inContext ( string $context = '' ) : boolean Should this menu item be used given the current context
setChildren ( ElggMenuItem[] $children ) : void Set the menu item's children
setConfirmText ( string $text ) : void Set the confirm text shown when link is clicked
setContext ( array $contexts ) : void Set the contexts that this menu item is available for
setData ( mixed $key, mixed $value = null ) : void Set a data key/value pair or a set of key/value pairs
setDeps ( string[] | string $modules ) : void Set required AMD modules
setHref ( string $href ) : void Set the URL of the menu item
setItemClass ( mixed $class ) : void Set the li classes
setLinkClass ( mixed $class ) : void Set the anchor class
setName ( string $name ) : void Set the identifier of the menu item
setParent ( ElggMenuItem $parent ) : void Set the parent menu item
setParentName ( string $name ) : void Set the parent identifier
setPriority ( integer $priority ) : void Set the priority of the menu item
setSection ( string $section ) : void Set the section identifier
setSelected ( boolean $state = true ) : void Set the selected flag
setText ( string $text ) : void Set the display text of the menu item
setTooltip ( string $text ) : void Set the tool tip text
sortChildren ( string $sortFunction ) : void Sort the children

Защищенные методы

Метод Описание
addClass ( array &$current, mixed $additional ) : void Add additional classes

Описание методов

__construct() публичный Метод

\ElggMenuItem constructor
public __construct ( string $name, string $text, string $href )
$name string Identifier of the menu item
$text string Display text of the menu item (HTML)
$href string URL of the menu item (false if not a link)

addChild() публичный Метод

This is reserved for the \ElggMenuBuilder.
public addChild ( ElggMenuItem $item ) : void
$item ElggMenuItem A child menu item
Результат void

addClass() защищенный Метод

Add additional classes
protected addClass ( array &$current, mixed $additional ) : void
$current array The current array of classes
$additional mixed Additional classes (either array of string)
Результат void

addDeps() публичный Метод

Add required AMD modules
public addDeps ( string[] | string $modules ) : void
$modules string[] | string One or more required AMD modules
Результат void

addItemClass() публичный Метод

Add a li class
С версии: 1.9.0
public addItemClass ( mixed $class ) : void
$class mixed An array of class names, or a single string class name.
Результат void

addLinkClass() публичный Метод

Add a link class
public addLinkClass ( mixed $class ) : void
$class mixed An array of class names, or a single string class name.
Результат void

getChildren() публичный Метод

This is reserved for the \ElggMenuBuilder.
public getChildren ( ) : ElggMenuItem[]
Результат ElggMenuItem[]

getConfirmText() публичный Метод

Get the confirm text
public getConfirmText ( ) : string
Результат string

getContext() публичный Метод

Get an array of context strings
public getContext ( ) : array
Результат array

getData() публичный Метод

Get stored data
public getData ( string $key ) : mixed
$key string The key for the requested key/value pair
Результат mixed

getDeps() публичный Метод

Get required AMD modules
public getDeps ( ) : string[]
Результат string[]

getHref() публичный Метод

Get the URL of the menu item
public getHref ( ) : string
Результат string

getItemClass() публичный Метод

Get the li classes as text
public getItemClass ( ) : string
Результат string

getLinkClass() публичный Метод

Get the anchor classes as text
public getLinkClass ( ) : string
Результат string

getName() публичный Метод

Get the identifier of the menu item
public getName ( ) : string
Результат string

getParent() публичный Метод

This is reserved for the \ElggMenuBuilder.
public getParent ( ) : ElggMenuItem
Результат ElggMenuItem or null

getParentName() публичный Метод

Get the parent identifier
public getParentName ( ) : string
Результат string

getPriority() публичный Метод

Get the priority of the menu item
public getPriority ( ) : integer
Результат integer

getSection() публичный Метод

Get the section identifier
public getSection ( ) : string
Результат string

getSelected() публичный Метод

Get selected state
public getSelected ( ) : boolean
Результат boolean

getText() публичный Метод

Get the display text of the menu item
public getText ( ) : string
Результат string The display text as HTML

getTooltip() публичный Метод

Get the tool tip text
public getTooltip ( ) : string
Результат string

getValues() публичный Метод

Get all the values for this menu item. Useful for rendering.
С версии: 1.9.0
public getValues ( ) : array
Результат array

inContext() публичный Метод

Should this menu item be used given the current context
public inContext ( string $context = '' ) : boolean
$context string A context string (default is empty string for current context stack).
Результат boolean

setChildren() публичный Метод

This is reserved for the \ElggMenuBuilder.
public setChildren ( ElggMenuItem[] $children ) : void
$children ElggMenuItem[] Array of items
Результат void

setConfirmText() публичный Метод

Set the confirm text shown when link is clicked
public setConfirmText ( string $text ) : void
$text string The text to show
Результат void

setContext() публичный Метод

Set the contexts that this menu item is available for
public setContext ( array $contexts ) : void
$contexts array An array of context strings. Use 'all' to match all contexts.
Результат void

setData() публичный Метод

This method allows storage of arbitrary data with this menu item. The data can be used for sorting, custom rendering, or any other use.
public setData ( mixed $key, mixed $value = null ) : void
$key mixed String key or an associative array of key/value pairs
$value mixed The value if $key is a string
Результат void

setDeps() публичный Метод

Set required AMD modules
public setDeps ( string[] | string $modules ) : void
$modules string[] | string One or more required AMD modules
Результат void

setHref() публичный Метод

Set the URL of the menu item
public setHref ( string $href ) : void
$href string URL or false if not a link
Результат void

setItemClass() публичный Метод

Set the li classes
public setItemClass ( mixed $class ) : void
$class mixed An array of class names, or a single string class name.
Результат void

setLinkClass() публичный Метод

Set the anchor class
public setLinkClass ( mixed $class ) : void
$class mixed An array of class names, or a single string class name.
Результат void

setName() публичный Метод

Set the identifier of the menu item
public setName ( string $name ) : void
$name string Unique identifier
Результат void

setParent() публичный Метод

This is reserved for the \ElggMenuBuilder.
public setParent ( ElggMenuItem $parent ) : void
$parent ElggMenuItem The parent of this menu item
Результат void

setParentName() публичный Метод

Set the parent identifier
public setParentName ( string $name ) : void
$name string The identifier of the parent \ElggMenuItem
Результат void

setPriority() публичный Метод

Set the priority of the menu item
public setPriority ( integer $priority ) : void
$priority integer The smaller numbers mean higher priority (1 before 100)
Результат void

setSection() публичный Метод

Set the section identifier
public setSection ( string $section ) : void
$section string The identifier of the section
Результат void

setSelected() публичный Метод

Set the selected flag
public setSelected ( boolean $state = true ) : void
$state boolean Selected state (default is true)
Результат void

setText() публичный Метод

Set the display text of the menu item
public setText ( string $text ) : void
$text string The display text as HTML
Результат void

setTooltip() публичный Метод

Set the tool tip text
public setTooltip ( string $text ) : void
$text string The text of the tool tip
Результат void

sortChildren() публичный Метод

This is reserved for the \ElggMenuBuilder.
public sortChildren ( string $sortFunction ) : void
$sortFunction string A function that is passed to usort()
Результат void

Описание свойств

$confirm защищенное свойство

The string to display if link is clicked
protected $confirm

$data защищенное свойство

Non-rendered data about the menu item
protected $data

$href защищенное свойство

The menu url
protected $href

$text защищенное свойство

The menu display string (HTML)
protected $text

$title защищенное свойство

Tooltip
protected $title