CategoryNode
Extends CMSObject Implements NodeInterfaceHelper class to load Categorytree
since |
1.6 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor, overridden in descendant classes.
__construct(mixed properties = null) : mixed
since |
1.7.0 |
---|
Arguments
- properties
mixed
Either 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
since |
1.7.0 |
---|---|
deprecated |
3.1.4 Classes should provide their own __toString() implementation. |
Response
string
The classname.
addChild
Add child to this node
addChild(\Joomla\CMS\Tree\NodeInterface child) : void
If the child already has a parent, the link is unset
since |
4.0.0 |
---|
Arguments
- child
\Joomla\CMS\Tree\NodeInterface
The child to be added.
def
Sets a default value if not already assigned
def(string property, mixed default = null) : mixed
since |
1.7.0 |
---|
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(string property, mixed default = null) : mixed
since |
1.7.0 |
---|---|
see | CMSObject::getProperties() |
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(bool modifiedUser = false) : \Joomla\CMS\User\User
since |
1.6 |
---|
Arguments
- modifiedUser
bool
Returns the modified_user when set to true
Response
\Joomla\CMS\User\User
A 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
bool
False by default
Response
\Joomla\CMS\Categories\CategoryNode[]
The children
getError
Get the most recent error message.
getError(int i = null, bool toString = true) : string
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
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() : array
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
Response
array
Array of error messages.
getMetadata
Returns the category metadata
getMetadata() : \Joomla\Registry\Registry
since |
1.6 |
---|
Response
\Joomla\Registry\Registry
A Registry object containing the metadata
getNumItems
Returns the number of items.
getNumItems(bool recursive = false) : int
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
\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
since |
1.7.0 |
---|---|
see | CMSObject::get() |
Arguments
- public
bool
If 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
bool
If set to false, returns the left sibling
Response
\Joomla\CMS\Categories\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) : void
since |
4.0.0 |
---|
Arguments
- child
\Joomla\CMS\Tree\NodeInterface
Child to remove
set
Modifies a property of the object, creating it if it does not already exist.
set(string property, mixed value = null) : mixed
since |
1.7.0 |
---|
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() : void
since |
1.6 |
---|
setError
Add an error message.
setError(string error) : void
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
Arguments
- error
string
Error message.
setParent
Set the parent of this node
setParent(\Joomla\CMS\Tree\NodeInterface|null parent) : void
If the node already has a parent, the link is unset
since |
4.0.0 |
---|
Arguments
- parent
\Joomla\CMS\Tree\NodeInterface|null
NodeInterface for the parent to be set or null
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed properties) : bool
since |
1.7.0 |
---|---|
see | CMSObject::set() |
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, bool right = true) : void
since |
4.0.0 |
---|
Arguments
- sibling
\Joomla\CMS\Tree\NodeInterface
NodeInterface object for the sibling- right
bool
If set to false, the sibling is the left one
Properties
parent_id
The id of the parent of category in the asset table, 0 for category root
_errors
An array of error messages or Exception objects.