MenuItem extends AbstractControl
MenuItem
Table of Contents
Properties
- $active : bool
- Sets the active state of the menuItem
- $classes : string
- HTML tag attribute for class
- $dataAttributes : array<string|int, mixed>
- HTML tag attributes for data-* Use key => value pairs
- $href : string
- Sets the href of the menuItem
- $onClick : string
- HTML tag attribute onClick Outdated, use sparingly
- $title : string
- HTML tag attribute for title
Methods
- getClasses() : string
- Get classes
- getDataAttributes() : array<string|int, mixed>
- Get Data attributes
- getHref() : string
- Get href
- getOnClick() : string
- Get Onclick Attribute
- getTitle() : string
- Get Title
- hasOnClick() : bool
- Helper method to avoid using `getOnClick` in TYPO3 core.
- isActive() : bool
- Check if is active
- isValid() : bool
- Validation
- setActive() : MenuItem
- Set active
- setClasses() : $this
- Set classes
- setDataAttributes() : $this
- Set Data attributes
- setHref() : MenuItem
- Set href
- setOnClick() : $this
- Set OnClick
- setTitle() : $this
- Set title attribute
Properties
$active
Sets the active state of the menuItem
protected
bool
$active
= false
$classes
HTML tag attribute for class
protected
string
$classes
= ''
$dataAttributes
HTML tag attributes for data-* Use key => value pairs
protected
array<string|int, mixed>
$dataAttributes
= []
$href
Sets the href of the menuItem
protected
string
$href
= ''
$onClick
HTML tag attribute onClick Outdated, use sparingly
Use HTML data attrs for GlobalEventHandler or ActionDispatcher instead. Will be removed in TYPO3 v12.0
protected
string
$onClick
= ''
$title
HTML tag attribute for title
protected
string
$title
= ''
Methods
getClasses()
Get classes
public
getClasses() : string
Return values
stringgetDataAttributes()
Get Data attributes
public
getDataAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getHref()
Get href
public
getHref() : string
Return values
stringgetOnClick()
Get Onclick Attribute
public
getOnClick() : string
Use HTML data attrs for GlobalEventHandler or ActionDispatcher instead. Will be removed in TYPO3 v12.0
Return values
stringgetTitle()
Get Title
public
getTitle() : string
Return values
stringhasOnClick()
Helper method to avoid using `getOnClick` in TYPO3 core.
public
hasOnClick() : bool
Introduced with TYPO3 v11.5, will be removed with TYPO3 v12.0
Basically just to be used by the TYPO3 core, not to be used in extensions.
Return values
boolisActive()
Check if is active
public
isActive() : bool
Return values
boolisValid()
Validation
public
isValid(MenuItem $menuItem) : bool
Parameters
- $menuItem : MenuItem
-
The menuItem to validate
Return values
boolsetActive()
Set active
public
setActive(bool $active) : MenuItem
Parameters
- $active : bool
-
Defines whether a menuItem is active
Return values
MenuItemsetClasses()
Set classes
public
setClasses(string $classes) : $this
Parameters
- $classes : string
-
HTML class attribute to set
Return values
$thissetDataAttributes()
Set Data attributes
public
setDataAttributes(array<string|int, mixed> $dataAttributes) : $this
Parameters
- $dataAttributes : array<string|int, mixed>
-
HTML data attributes to set
Return values
$thissetHref()
Set href
public
setHref(string $href) : MenuItem
Parameters
- $href : string
-
Href of the MenuItem
Return values
MenuItemsetOnClick()
Set OnClick
public
setOnClick(string $onClick) : $this
Use HTML data attrs for GlobalEventHandler or ActionDispatcher instead. Will be removed in TYPO3 v12.0
Parameters
- $onClick : string
-
HTML onClick attribute to set
Return values
$thissetTitle()
Set title attribute
public
setTitle(string $title) : $this
Parameters
- $title : string
-
HTML title attribute to set