API16:JNode/setParent
From Joomla! Documentation
Description
Set the parent of a this node
Syntax
setParent(&$parent)
| Parameter Name | Default Value | Description |
|---|---|---|
| &$parent | the parent to be setted |
Defined in
libraries/joomla/base/node.php
Importing
jimport( 'joomla.base.node' );
Source Body
function setParent(&$parent)
{
if ($parent instanceof JNode || is_null($parent))
{
$hash = spl_object_hash($this);
if (!is_null($this->_parent))
{
unset($this->_parent->children[$hash]);
}
if (!is_null($parent))
{
$parent->_children[$hash] = & $this;
}
$this->_parent = & $parent;
}
}
Examples
Code Examples