Add a child.

@param NodeContract $child

@return $this
433090
public function addChild(NodeContract $child)
    {
        $this->children[] = $child;

        $child->setParent($this);
        $child->setIndex(count($this->children) - 1);

        return $this;
    }
611112
public function addChild(LayoutInterface $child)
    {
        $this->children->add($child);
        $child->setParent($this);

        return $this;
    }
1335131
public function addChild(FieldInterface $child)
    {
        $this->children->add($child);
        $child->setLayout($this);

        return $this;
    }
1064328
public function insertBefore(AbstractNode $child, int $id): bool
	{
		return $this->addChild($child, $id);
	}
439127
public function addChild($child)
    {
        $children = $this->getChildren();
        array_push($children, $child);
        $this->setChildren($children);
    }
786983
public function addChild(self $child)
    {
        if ($this->isVoid) {
            throw new Exception\RuntimeException(
                'Void elements can\'t have child elements.'
            );
        }

        $this->children[] = $child;

        return $this;
    }
225254
public function addChild(TreeNodeInterface $node)
    {
        $this->children[] = $node;
        $node->setParent($this);

        return $this;
    }
141865
protected function insertBeforeChild(Node $child, Node $node) {
    $this->childCount++;
    $node->parent = $this;
    if ($child->previous === NULL) {
      $this->head = $node;
    }
    else {
      $child->previous->next = $node;
    }
    $node->previous = $child->previous;
    $node->next = $child;
    $child->previous = $node;
    return $this;
  }
499218
function appendChild(&$child) {
             
            // Set child's parentNode
            $child->parentNode = & $this;
             
            // Add child to list of childNodes
            $this->childNodes[] = & $child;
             
            // Is child of type node?
            if ($child->nodeType == XML_TYPE_NODE) {
                 
                // Set child's previousSibling
                $child->previousSibling = & $this->lastChild;
            }
             
            // Is this node of type node?
            if ($this->nodeType != null && $this->nodeType == XML_TYPE_NODE) {
                 
                // Set current lastChild's nextSibling to this child
                if (!is_null($this->lastChild)) {
                    $this->lastChild->nextSibling = & $child;
                }
                 
                // Now (re)set firstChild and lastChild
                $this->firstChild = & $this->childNodes[0];
                $this->lastChild = & $child;
            }
             
        }
1245339
public function addChild(AbstractNode $child)
    {
        $key = null;

        // check integrity
        if ($this->isAncestor($child->id())) {
            throw new CircularException('Can not add child. It is my ancestor.');
        }

        // check if child is itself
        if ($child->id() == $this->id) {
            throw new CircularException('Can not set itself as a child.');
        }

        if ($this->hasChildren()) {
            if (isset($this->children[$child->id()])) {
                // we already have this child
                return false;
            }
            $sibling                      = $this->lastChild();
            $key                          = $sibling->id();
            $this->children[$key]['next'] = $child->id();
        }

        // add the child
        $this->children[$child->id()] = [
            'node' => $child,
            'next' => null,
            'prev' => $key,
        ];

        // tell child I am the new parent
        $child->setParent($this);

        //clear any cache
        $this->clear();

        return true;
    }
817861
public function addChild($child)
    {
        $child->parent = $this;
        $child->index = count($this->children);
        $this->children[] = $child;
    }
269394
public function addChild(CategoryInterface $child)
    {
        $child->setParent($this);
        $this->children[] = $child;

        return $this;
    }
1121481
public function addChild(Content $child)
    {
        $this->pages[$child->id] = $child;

        // Group by category
        if (!isset($this->categories[$child->category])) {
            $this->categories[$child->category] = [];
        }

        // Add post to category
        $this->categories[$child->category][] = $child;
    }
289670
public function addChild( $name, $child )
	{
		if( isset( $this->children[$name] ) )
			throw new InvalidArgumentException( 'A Child with Name "'.$name.'" is already existing.' );
		$this->children[$name] = $child;
	}
799132
public function addChild(Node $child)
    {
        $this->children[]                           = $child;
        $child->parent                              = $this;
        $child->properties[$this->config['parent']] = $this->properties[$this->config['pk']];
    }
836970
public function addChildBeforeNodeByIndex(NodeContract $child, int $index)
    {
        return $this->replaceChild($index, [$child, $this->getChildByIndex($index)]);
    }
1138074
public function addChild(AccountInterface $child)
    {
        $this->children->add($child);
        $child->setParent($this);
        $child->setOrganization($this->getOrganization());

        return $this;
    }