CategoryNode

Extends CMSObject Implements NodeInterface

Helper class to load Categorytree

since

1.6

package

Application

Methods

__construct

Class constructor, overridden in descendant classes.

__construct(mixed properties = null) : mixed
inherited
since

1.7.0

Arguments

properties

mixedEither and associative array or another object to set the initial properties of the object.

Response

mixed

__toString

Magic method to convert the object to a string gracefully.

__toString() : string
inherited deprecated
since

1.7.0

deprecated

3.1.4 Classes should provide their own __toString() implementation.

Response

stringThe classname.

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.

def

Sets a default value if not already assigned

def(string property, mixed default = null) : mixed
inherited
since

1.7.0

Arguments

property

stringThe name of the property.

default

mixedThe default value.

Response

mixed

get

Returns a property of the object or the default value if the property is not set.

get(string property, mixed default = null) : mixed
inherited
since

1.7.0

see CMSObject::getProperties()

Arguments

property

stringThe name of the property.

default

mixedThe default value.

Response

mixedThe value of the property.

getAuthor

Returns the user that created the category

getAuthor(bool modifiedUser = false) : \Joomla\CMS\User\User
since

1.6

Arguments

modifiedUser

boolReturns the modified_user when set to true

Response

\Joomla\CMS\User\UserA User object containing a userid

getChildren

Get the children of this node

getChildren(bool recursive = false) : \Joomla\CMS\Categories\CategoryNode[]
since

1.6

Arguments

recursive

boolFalse by default

Response

\Joomla\CMS\Categories\CategoryNode[]The children

getError

Get the most recent error message.

getError(int i = null, bool toString = true) : string
inherited deprecated
since

1.7.0

deprecated

3.1.4 JError has been deprecated

Arguments

i

intOption error index.

toString

boolIndicates if Exception objects should return their error message.

Response

stringError message

getErrors

Return all errors, if any.

getErrors() : array
inherited deprecated
since

1.7.0

deprecated

3.1.4 JError has been deprecated

Response

arrayArray of error messages.

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(bool recursive = false) : int
since

1.6

Arguments

recursive

boolIf false number of children, if true number of descendants

Response

intNumber of children or descendants

getParams

Returns the category parameters

getParams() : \Joomla\Registry\Registry
since

1.6

Response

\Joomla\Registry\Registry

getPath

Returns the category path to the root category

getPath() : array
since

1.6

Response

array

getProperties

Returns an associative array of object properties.

getProperties(bool public = true) : array
inherited
since

1.7.0

see CMSObject::get()

Arguments

public

boolIf true, returns only the public properties.

Response

array

getSibling

Returns the right or left sibling of a category

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

1.6

Arguments

right

boolIf 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.

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

set

Modifies a property of the object, creating it if it does not already exist.

set(string property, mixed value = null) : mixed
inherited
since

1.7.0

Arguments

property

stringThe name of the property.

value

mixedThe value of the property to set.

Response

mixedPrevious value of the property.

setAllLoaded

Set to load all children

setAllLoaded() : void
since

1.6

setError

Add an error message.

setError(string error) : void
inherited deprecated
since

1.7.0

deprecated

3.1.4 JError has been deprecated

Arguments

error

stringError message.

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

setProperties

Set the object properties based on a named array/hash.

setProperties(mixed properties) : bool
inherited
since

1.7.0

see CMSObject::set()

Arguments

properties

mixedEither an associative array or another object.

Response

bool

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

1.6

Type(s)

int

asset_id

The id of the category in the asset table

since

1.6

Type(s)

int

parent_id

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

since

1.6

Type(s)

int

lft

The lft value for this category in the category tree

since

1.6

Type(s)

int

rgt

The rgt value for this category in the category tree

since

1.6

Type(s)

int

level

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

since

1.6

Type(s)

int

extension

The extension this category is associated with

since

1.6

Type(s)

int

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)

bool

checked_out

Whether the category is or is not checked out

since

1.6

Type(s)

bool

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)

int

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)

int

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)

int

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)

int

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)

int

childrennumitems

Number of children items

since

1.6

Type(s)

int

slug

Slug for the category (used in URL)

since

1.6

Type(s)

string

assets

Array of assets

since

1.6

Type(s)

array

_path

Path from root to this category

since

1.6

Type(s)

array

_allChildrenloaded

Flag if all children have been loaded

since

1.6

Type(s)

bool

_constructor

Constructor of this tree

since

1.6

Type(s)

Categories

_errors

An array of error messages or Exception objects.

inherited deprecated
since

1.7.0

deprecated

3.1.4 JError has been deprecated

Type(s)

array