CategoryNode

Extends \JObject

Helper class to load Categorytree

since

1.6

Methods

__construct

Class constructor

__construct(array $category = null, \Joomla\CMS\Categories\CategoryNode $constructor = null) 
since

1.6

Arguments

$category

arrayThe category data.

$constructor

\Joomla\CMS\Categories\CategoryNodeThe tree constructor.

addChild

Add child to this node

addChild(\Joomla\CMS\Categories\CategoryNode $child) : void

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

since

1.6

Arguments

$child

\Joomla\CMS\Categories\CategoryNodeThe child to be added.

getAuthor

Returns the user that created the category

getAuthor(boolean $modifiedUser = false) : \JUser
since

1.6

Arguments

$modifiedUser

booleanReturns the modified_user when set to true

Response

\JUserA \JUser object containing a userid

getChildren

Get the children of this node

getChildren(boolean $recursive = false) : array<mixed,\Joomla\CMS\Categories\CategoryNode>
since

1.6

Arguments

$recursive

booleanFalse by default

Response

array<mixed,\Joomla\CMS\Categories\CategoryNode>The children

getMetadata

Returns the category metadata

getMetadata() : \Joomla\Registry\Registry
since

1.6

Response

\Joomla\Registry\RegistryA Registry object containing the metadata

getNumItems

Returns the number of items.

getNumItems(boolean $recursive = false) : integer
since

1.6

Arguments

$recursive

booleanIf false number of children, if true number of descendants

Response

integerNumber of children or descendants

getParams

Returns the category parameters

getParams() : \Joomla\Registry\Registry
since

1.6

Response

\Joomla\Registry\Registry

getParent

Get the parent of this node

getParent() : \Joomla\CMS\Categories\CategoryNode

getPath

Returns the category path to the root category

getPath() : array
since

1.6

Response

array

getSibling

Returns the right or left sibling of a category

getSibling(boolean $right = true) : \Joomla\CMS\Categories\CategoryNode|null
since

1.6

Arguments

$right

booleanIf set to false, returns the left sibling

Response

\Joomla\CMS\Categories\CategoryNode|nullCategoryNode object with the sibling information or null if there is no sibling on that side.

hasChildren

Test if this node has children

hasChildren() : boolean
since

1.6

Response

booleanTrue if there is a child

hasParent

Test if this node has a parent

hasParent() : boolean
since

1.6

Response

booleanTrue if there is a parent

removeChild

Remove a specific child

removeChild(integer $id) : void
since

1.6

Arguments

$id

integerID of a category

setAllLoaded

Set to load all children

setAllLoaded() : void
since

1.6

setParent

Set the parent of this category

setParent(\Joomla\CMS\Categories\CategoryNode|null $parent) : void

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

since

1.6

Arguments

$parent

\Joomla\CMS\Categories\CategoryNode|nullCategoryNode for the parent to be set or null

setSibling

Function to set the left or right sibling of a category

setSibling(\Joomla\CMS\Categories\CategoryNode $sibling, boolean $right = true) : void
since

1.6

Arguments

$sibling

\Joomla\CMS\Categories\CategoryNodeCategoryNode object for the sibling

$right

booleanIf set to false, the sibling is the left one

Properties

id

Primary key

since

1.6

Type(s)

integer

asset_id

The id of the category in the asset table

since

1.6

Type(s)

integer

parent_id

The id of the parent of category in the asset table, 0 for category root

since

1.6

Type(s)

integer

lft

The lft value for this category in the category tree

since

1.6

Type(s)

integer

rgt

The rgt value for this category in the category tree

since

1.6

Type(s)

integer

level

The depth of this category's position in the category tree

since

1.6

Type(s)

integer

extension

The extension this category is associated with

since

1.6

Type(s)

integer

title

The menu title for the category (a short name)

since

1.6

Type(s)

string

alias

The the alias for the category

since

1.6

Type(s)

string

description

Description of the category.

since

1.6

Type(s)

string

published

The publication status of the category

since

1.6

Type(s)

boolean

checked_out

Whether the category is or is not checked out

since

1.6

Type(s)

boolean

checked_out_time

The time at which the category was checked out

since

1.6

Type(s)

string

access

Access level for the category

since

1.6

Type(s)

integer

params

JSON string of parameters

since

1.6

Type(s)

string

metadesc

Metadata description

since

1.6

Type(s)

string

metakey

Key words for metadata

since

1.6

Type(s)

string

metadata

JSON string of other metadata

since

1.6

Type(s)

string

created_user_id

The ID of the user who created the category

since

1.6

Type(s)

integer

created_time

The time at which the category was created

since

1.6

Type(s)

string

modified_user_id

The ID of the user who last modified the category

since

1.6

Type(s)

integer

modified_time

The time at which the category was modified

since

1.6

Type(s)

string

hits

Number of times the category has been viewed

since

1.6

Type(s)

integer

language

The language for the category in xx-XX format

since

1.6

Type(s)

string

numitems

Number of items in this category or descendants of this category

since

1.6

Type(s)

integer

childrennumitems

Number of children items

since

1.6

Type(s)

integer

slug

Slug fo the category (used in URL)

since

1.6

Type(s)

string

assets

Array of assets

since

1.6

Type(s)

array

_parent

Parent Category object

_children

Array of Children

since

1.6

Type(s)

array<mixed,\Joomla\CMS\Categories\CategoryNode>

_path

Path from root to this category

since

1.6

Type(s)

array

_leftSibling

Category left of this one

_rightSibling

Category right of this one

_allChildrenloaded

Flag if all children have been loaded

since

1.6

Type(s)

boolean

_constructor

Constructor of this tree