CategoryNode
Extends CMSObject Implements NodeInterfaceHelper class to load Categorytree
since |
1.6 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor
__construct(mixed||string|int category = null, \Joomla\CMS\Categories\Categories constructor = null) :
since |
1.6 |
---|
Arguments
- category
array<string|int, mixed>
The category data.- constructor
Categories
The tree constructor.
Response
mixed
__serialize
Serialize the node.
__serialize() :
since |
4.3.2 |
---|
Response
mixed
__toString
Magic method to convert the object to a string gracefully.
__toString() :
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Classes should provide their own __toString() implementation. |
Response
string
The classname.
__unserialize
Unserialize the node.
__unserialize(mixed||string|int data) :
since |
4.3.2 |
---|
Arguments
- data
array<string|int, mixed>
Response
mixed
addChild
Add child to this node
addChild(\Joomla\CMS\Tree\NodeInterface child) :
If the child already has a parent, the link is unset
since |
4.0.0 |
---|
Arguments
- child
NodeInterface
The child to be added.
Response
void
def
Sets a default value if not already assigned
def( property, default = null) :
since |
1.7.0 |
---|---|
deprecated |
4.3.0 will be removed in 6.0 Defining dynamic properties should not be used anymore |
Arguments
- property
string
The name of the property.- default
mixed
The default value.
Response
mixed
get
Returns a property of the object or the default value if the property is not set.
get( property, default = null) :
since |
1.7.0 |
---|---|
see | CMSObject::getProperties() |
deprecated |
4.3.0 will be removed in 6.0 Create a proper getter function for the property |
Arguments
- property
string
The name of the property.- default
mixed
The default value.
Response
mixed
The value of the property.
getAuthor
Returns the user that created the category
getAuthor( modifiedUser = false) : \Joomla\CMS\User\User
since |
1.6 |
---|
Arguments
- modifiedUser
bool
Returns the modified_user when set to true
Response
User
A User object containing a userid
getChildren
Get the children of this node
getChildren( recursive = false) : \Joomla\CMS\Categories\CategoryNode||string|int
since |
1.6 |
---|
Arguments
- recursive
bool
False by default
Response
array<string|int, CategoryNode>
The children
getError
Get the most recent error message.
getError( i = null, toString = true) :
since |
1.7.0 |
---|---|
deprecated |
3.1.4 will be removed in 6.0 Will be removed without replacement Catch thrown Exceptions instead of getError |
Arguments
- i
int
Option error index.- toString
bool
Indicates if Exception objects should return their error message.
Response
string
Error message
getErrors
Return all errors, if any.
getErrors() : mixed||string|int
since |
1.7.0 |
---|---|
deprecated |
3.1.4 will be removed in 6.0 Will be removed without replacement Catch thrown Exceptions instead of getErrors |
Response
array<string|int, mixed>
Array of error messages.
getMetadata
Returns the category metadata
getMetadata() : \Joomla\Registry\Registry
since |
1.6 |
---|
Response
Registry
A Registry object containing the metadata
getNumItems
Returns the number of items.
getNumItems( recursive = false) :
since |
1.6 |
---|
Arguments
- recursive
bool
If false number of children, if true number of descendants
Response
int
Number of children or descendants
getParams
Returns the category parameters
getParams() : \Joomla\Registry\Registry
since |
1.6 |
---|
Response
Registry
getPath
Returns the category path to the root category
getPath() : mixed||string|int
since |
1.6 |
---|
Response
array<string|int, mixed>
getProperties
Returns an associative array of object properties.
getProperties( public = true) : mixed||string|int
since |
1.7.0 |
---|---|
see | CMSObject::get() |
deprecated |
4.3.0 will be removed in 6.0 Create a proper getter function for the property |
Arguments
- public
bool
If true, returns only the public properties.
Response
array<string|int, mixed>
getSibling
Returns the right or left sibling of a category
getSibling( right = true) : \Joomla\CMS\Categories\CategoryNode|null
since |
1.6 |
---|
Arguments
- right
bool
If set to false, returns the left sibling
Response
CategoryNode|null
CategoryNode 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) :
set
Modifies a property of the object, creating it if it does not already exist.
set( property, value = null) :
since |
1.7.0 |
---|---|
deprecated |
4.3.0 will be removed in 6.0 Create a proper setter function for the property |
Arguments
- property
string
The name of the property.- value
mixed
The value of the property to set.
Response
mixed
Previous value of the property.
setAllLoaded
Set to load all children
setAllLoaded() :
since |
1.6 |
---|
Response
void
setError
Add an error message.
setError( error) :
since |
1.7.0 |
---|---|
deprecated |
3.1.4 will be removed in 6.0 Will be removed without replacement Throw an Exception instead of using setError |
Arguments
- error
string
Error message.
Response
void
setParent
Set the parent of this category
setParent(\Joomla\CMS\Tree\NodeInterface parent) :
If the category already has a parent, the link is unset
since |
1.6 |
---|
Arguments
- parent
NodeInterface
CategoryNode for the parent to be set or null
Response
void
setProperties
Set the object properties based on a named array/hash.
setProperties( properties) :
since |
1.7.0 |
---|---|
see | CMSObject::set() |
deprecated |
4.3.0 will be removed in 6.0 Create a proper setter function for the property |
Arguments
- properties
mixed
Either 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, right = true) :
since |
4.0.0 |
---|
Arguments
- sibling
NodeInterface
NodeInterface object for the sibling- right
bool
If set to false, the sibling is the left one
Response
void
Properties
_errors
An array of error messages or Exception objects.
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
Type(s)
array<string|int, mixed>
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 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
Keywords 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
slug
Slug for the category (used in URL)
since |
1.6 |
---|
Type(s)
string
assets
Array of assets
since |
1.6 |
---|
Type(s)
array<string|int, mixed>
_path
Path from root to this category
since |
1.6 |
---|
Type(s)
array<string|int, mixed>
_allChildrenloaded
Flag if all children have been loaded
since |
1.6 |
---|
Type(s)
bool