[ Index ]

PHP Cross Reference of DokuWiki




/inc/Menu/Item/ -> AbstractItem.php (summary)

(no description)

File Size: 253 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

AbstractItem:: (14 methods):

Class: AbstractItem  - X-Ref

Class AbstractItem

This class defines a single Item to be displayed in one of DokuWiki's menus. Plugins
can extend those menus through action plugins and add their own instances of this class,
overwriting some of its properties.

Items may be shown multiple times in different contexts. Eg. for the default template
all menus are shown in a Dropdown list on mobile, but are split into several places on
desktop. The item's $context property can be used to hide the item depending on the current

Children usually just need to overwrite the different properties, but for complex things
the accessors may be overwritten instead.
__construct()   X-Ref
AbstractItem constructor.

Sets the dynamic properties

Children should always call the parent constructor!

getLabel()   X-Ref
Return this item's label

When the label property was set, it is simply returned. Otherwise, the action's type
is used to look up the translation in the main language file and, if used, the replacement
is applied.

return: string

getTitle()   X-Ref
Return this item's title

This title should be used to display a tooltip (using the HTML title attribute). If
a title property was not explicitly set, the label will be returned.

return: string

getLink()   X-Ref
Return the link this item links to

Basically runs wl() on $id and $params. However if the ID is a hash it is used directly
as the link

Please note that the generated URL is *not* XML escaped.

return: string
see: wl()

getLinkAttributes($classprefix = 'menuitem ')   X-Ref
Convenience method to get the attributes for constructing an <a> element

param: string|false $classprefix create a class from type with this prefix, false for no class
return: array
see: buildAttributes()

asHtmlLink($classprefix = 'menuitem ', $svg = true)   X-Ref
Convenience method to create a full <a> element

Wraps around the label and SVG image

param: string|false $classprefix create a class from type with this prefix, false for no class
param: bool $svg add SVG icon to the link
return: string

asHtmlButton()   X-Ref
Convenience method to create a <button> element inside it's own form element

Uses html_btn()

return: string

visibleInContext($ctx)   X-Ref
Should this item be shown in the given context

param: int $ctx the current context
return: bool

getType()   X-Ref

return: string the name of this item

getAccesskey()   X-Ref

return: string

getParams()   X-Ref

return: array

isNofollow()   X-Ref

return: bool

getSvg()   X-Ref

return: string

getLegacyData()   X-Ref
Return this Item's settings as an array as used in tpl_get_action()

return: array