MenuItem

Implements NodeInterface

Object representing a menu item

since

3.7.0

package

Application

Methods

__construct

Class constructor

__construct(array data = array()) : mixed
since

3.7.0

Arguments

data

arrayThe menu item data to load

Response

mixed

addChild

Add child to this node

addChild(\Joomla\CMS\Tree\NodeInterface child) : void
inherited

If the child already has a parent, the link is unset

since

4.0.0

Arguments

child

\Joomla\CMS\Tree\NodeInterfaceThe child to be added.

getParams

Returns the menu item parameters

getParams() : \Joomla\Registry\Registry
since

3.7.0

Response

\Joomla\Registry\Registry

removeChild

Remove a specific child

removeChild(\Joomla\CMS\Tree\NodeInterface child) : void
inherited
since

4.0.0

Arguments

child

\Joomla\CMS\Tree\NodeInterfaceChild to remove

setParams

Sets the menu item parameters

setParams(\Joomla\Registry\Registry|string params) : void
since

3.7.0

Arguments

params

\Joomla\Registry\Registry|stringThe data to be stored as the parameters

setParent

Set the parent of this node

setParent(\Joomla\CMS\Tree\NodeInterface|null parent) : void
inherited

If the node already has a parent, the link is unset

since

4.0.0

Arguments

parent

\Joomla\CMS\Tree\NodeInterface|nullNodeInterface for the parent to be set or null

setSibling

Function to set the left or right sibling of a node

setSibling(\Joomla\CMS\Tree\NodeInterface sibling, bool right = true) : void
inherited
since

4.0.0

Arguments

sibling

\Joomla\CMS\Tree\NodeInterfaceNodeInterface object for the sibling

right

boolIf set to false, the sibling is the left one

Properties

id

Primary key

since

3.7.0

Type(s)

int

menutype

The type of menu this item belongs to

since

3.7.0

Type(s)

int

title

The display title of the menu item

since

3.7.0

Type(s)

string

alias

The SEF alias of the menu item

since

3.7.0

Type(s)

string

note

A note associated with the menu item

since

3.7.0

Type(s)

string

route

The computed path of the menu item based on the alias field, this is populated from the path field in the #__menu table

since

3.7.0

Type(s)

string

type

The type of link

since

3.7.0

Type(s)

string

level

The relative level in the tree

since

3.7.0

Type(s)

int

language

The assigned language for this item

since

3.7.0

Type(s)

string

browserNav

The click behaviour of the link

since

3.7.0

Type(s)

int

access

The access level required to view the menu item

since

3.7.0

Type(s)

int

params

The menu item parameters

since

3.7.0

note

This field is protected to require reading this field to proxy through the getter to convert the params to a Registry instance

Type(s)

Registry

home

Indicates if this menu item is the home or default page

since

3.7.0

Type(s)

int

img

The image of the menu item

since

3.7.0

Type(s)

string

template_style_id

The optional template style applied to this menu item

since

3.7.0

Type(s)

int

component_id

The extension ID of the component this menu item is for

since

3.7.0

Type(s)

int

parent_id

The parent menu item in the menu tree

since

3.7.0

Type(s)

int

component

The name of the component this menu item is for

since

3.7.0

Type(s)

string

tree

The tree of parent menu items

since

3.7.0

Type(s)

array

query

An array of the query string values for this item

since

3.7.0

Type(s)

array