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
파일 보기 프로젝트 열기: elgg/elgg 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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