JCategoryNode
Extends \JObjectHelper class to load Categorytree
This class allows for simple but smart objects with get and set methods and an internal error handler.
package |
Joomla.Platform |
---|---|
subpackage |
Application |
since |
11.1 |
Methods
__construct
Class constructor, overridden in descendant classes.
__construct(mixed $properties = null)
since |
11.1 |
---|
Arguments
- $properties
mixed
Either and associative array or another object to set the initial properties of the object.
__toString
Magic method to convert the object to a string gracefully.
__toString() : string
since |
11.1 |
---|---|
deprecated |
12.3 Classes should provide their own __toString() implementation. |
Response
string
The classname.
addChild
Add child to this node
addChild( &$child) : void
If the child already has a parent, the link is unset
since |
11.1 |
---|
Arguments
- $child
def
Sets a default value if not alreay assigned
def(string $property, mixed $default = null) : mixed
since |
11.1 |
---|
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 |
11.1 |
---|---|
see | \JObject::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(boolean $modified_user = false) : \JUser
since |
11.1 |
---|
Arguments
- $modified_user
boolean
Returns the modified_user when set to true
Response
\JUser
A JUser object containing a userid
getChildren
Get the children of this node
getChildren(boolean $recursive = false) : array
since |
11.1 |
---|
Arguments
- $recursive
boolean
False by default
Response
array
The children
getError
Get the most recent error message.
getError(integer $i = null, boolean $toString = true) : string
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Arguments
- $i
integer
Option error index.- $toString
boolean
Indicates if JError objects should return their error message.
Response
string
Error message
getErrors
Return all errors, if any.
getErrors() : array
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Response
array
Array of error messages or JErrors.
getMetadata
Returns the category metadata
getMetadata() : \JRegistry
getNumItems
Returns the number of items.
getNumItems(boolean $recursive = false) : integer
since |
11.1 |
---|
Arguments
- $recursive
boolean
If false number of children, if true number of descendants
Response
integer
Number of children or descendants
getParent
Get the parent of this node
getParent() : mixed
since |
11.1 |
---|
Response
mixed
JNode or null
getPath
Returns the category path to the root category
getPath() : array
since |
11.1 |
---|
Response
array
getProperties
Returns an associative array of object properties.
getProperties(boolean $public = true) : array
since |
11.1 |
---|---|
see | \JObject::get() |
Arguments
- $public
boolean
If true, returns only the public properties.
Response
array
getSibling
Returns the right or left sibling of a category
getSibling(boolean $right = true) : mixed
since |
11.1 |
---|
Arguments
- $right
boolean
If set to false, returns the left sibling
Response
mixed
JCategoryNode 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 |
11.1 |
---|
Response
boolean
True if there is a child
hasParent
Test if this node has a parent
hasParent() : boolean
since |
11.1 |
---|
Response
boolean
True if there is a parent
removeChild
Remove a specific child
removeChild(integer $id) : void
since |
11.1 |
---|
Arguments
- $id
integer
ID of a category
set
Modifies a property of the object, creating it if it does not already exist.
set(string $property, mixed $value = null) : mixed
since |
11.1 |
---|
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 |
11.1 |
---|
setError
Add an error message.
setError(string $error) : void
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Arguments
- $error
string
Error message.
setParent
Set the parent of this category
setParent( &$parent) : void
If the category already has a parent, the link is unset
since |
11.1 |
---|
Arguments
- $parent
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed $properties) : boolean
since |
11.1 |
---|---|
see | \JObject::set() |
Arguments
- $properties
mixed
Either an associative array or another object.
Response
boolean
setSibling
Function to set the left or right sibling of a category
setSibling(object $sibling, boolean $right = true) : void
since |
11.1 |
---|
Arguments
- $sibling
object
JCategoryNode object for the sibling- $right
boolean
If set to false, the sibling is the left one
toString
Converts the object to a string (the class name).
toString() : string
Properties
id
Primary key
since |
11.1 |
---|
Type(s)
integer
asset_id
The id of the category in the asset table
since |
11.1 |
---|
Type(s)
integer
parent_id
The id of the parent of category in the asset table, 0 for category root
since |
11.1 |
---|
Type(s)
integer
lft
The lft value for this category in the category tree
since |
11.1 |
---|
Type(s)
integer
rgt
The rgt value for this category in the category tree
since |
11.1 |
---|
Type(s)
integer
level
The depth of this category's position in the category tree
since |
11.1 |
---|
Type(s)
integer
extension
The extension this category is associated with
since |
11.1 |
---|
Type(s)
integer
title
The menu title for the category (a short name)
since |
11.1 |
---|
Type(s)
string
alias
The the alias for the category
since |
11.1 |
---|
Type(s)
string
description
Description of the category.
since |
11.1 |
---|
Type(s)
string
published
The publication status of the category
since |
11.1 |
---|
Type(s)
boolean
checked_out
Whether the category is or is not checked out
since |
11.1 |
---|
Type(s)
boolean
checked_out_time
The time at which the category was checked out
since |
11.1 |
---|
Type(s)
\time
access
Access level for the category
since |
11.1 |
---|
Type(s)
integer
params
JSON string of parameters
since |
11.1 |
---|
Type(s)
string
metadesc
Metadata description
since |
11.1 |
---|
Type(s)
string
metakey
Key words for meta data
since |
11.1 |
---|
Type(s)
string
metadata
JSON string of other meta data
since |
11.1 |
---|
Type(s)
string
created_user_id
Type(s)
created_time
The time at which the category was created
since |
11.1 |
---|
Type(s)
\time
modified_user_id
Type(s)
modified_time
The time at which the category was modified
since |
11.1 |
---|
Type(s)
\time
hits
Nmber of times the category has been viewed
since |
11.1 |
---|
Type(s)
integer
language
The language for the category in xx-XX format
since |
11.1 |
---|
Type(s)
\time
numitems
Number of items in this category or descendants of this category
since |
11.1 |
---|
Type(s)
integer
childrennumitems
Number of children items
since |
11.1 |
---|
Type(s)
slug
Slug fo the category (used in URL)
since |
11.1 |
---|
Type(s)
string
assets
Array of assets
since |
11.1 |
---|
Type(s)
array
_parent
Parent Category object
since |
11.1 |
---|
Type(s)
object
_children
of Children
since |
11.1 |
---|
Type(s)
Array
_path
Path from root to this category
since |
11.1 |
---|
Type(s)
array
_leftSibling
Category left of this one
since |
11.1 |
---|
Type(s)
integer
_rightSibling
Category right of this one
since |
11.1 |
---|
Type(s)
_allChildrenloaded
true if all children have been loaded
since |
11.1 |
---|
Type(s)
boolean
_constructor
Constructor of this tree
since |
11.1 |
---|
Type(s)
_errors
An array of error messages or Exception objects.