Actions

API16

JNode/setParent

< API16:JNode

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

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


Advertisement