Add an element to a list

@param  mixed  $element
@param  string $name
@return ListUnordered
344299
public function addElement($element, $name = null, $attrsTerm = null, $attrsDesc = null) {
		if ($element instanceof DescListElement) {
			return parent::addElement($element, $name);
		}
		
		if (! is_array($element)) {
			throw new Exception('Element must be an array or the "ListElement" instance');
		}
		
		if (! isset($element[0], $element[1])) {
			throw new Exception('Element definition array must contain "0" and "1" offsets');
		}
		
		$newElement = new DescListElement($element[0], $element[1], $attrsTerm, $attrsDesc);
		
		return parent::addElement($newElement, $name);
	}
70623
public function insert($name, $element, $priority)
    {
        return $this->doCall(new Operation('PriorityQueue', 'insert', [$name, $element, $priority]));
    }
1338534
public function prependChild(Element $element)
	{
		$this->beforeInsert($element);
		
		array_unshift($this->children, $element);
		
		$this->afterInsert();
		
		return $this;
	}
1351267
public function addElement($element, $title = null, $name = null, $attrs = null) {
		if (! $element instanceof Element &&
			! $element instanceof Divider) {
			
			if ($element === self::DIVIDER) {
				$element = new Divider(null, $attrs);
			} else {
				if ($title === null) {
					$title = $element;
				}
				
				$element = new Element($element, $title, $attrs);
			}
		}
		
		if ($name === null && $title !== null) {
			$name = $title;
		}
		
		return parent::addElement($element, $name);
	}
528721
public function insertAfter($element)
    {
        $e = self::create($element);
        $newnodes = array();
        foreach ($e as $i => $node) {
            /** @var \DOMNode $node */
            $refnode = $node->nextSibling;
            foreach ($this as $newnode) {
                /** @var \DOMNode $newnode */
                $newnode = static::importNewnode($newnode, $node, $i);
                if ($refnode === null) {
                    $node->parentNode->appendChild($newnode);
                } else {
                    $node->parentNode->insertBefore($newnode, $refnode);
                }
                $newnodes[] = $newnode;
            }
        }
        return self::create($newnodes);
    }
1320875
static public function changeElementName(DOMElement $element, $name)
    {
        $newElement = $element->ownerDocument->createElement($name);

        foreach ($element->childNodes as $child) {
            $child = $element->ownerDocument->importNode($child, true);
            $newElement->appendChild($child);
        }

        foreach ($element->attributes as $attrName => $attrNode) {
            if ($attrNode->namespaceURI === null) {
                $newElement->setAttribute($attrName, $attrNode->value);
            } else {
                $newElement->setAttributeNS($attrNode->namespaceURI, $attrNode->prefix . ':' . $attrName, $attrNode->value);
            }

        }

        $newElement->ownerDocument->replaceChild($newElement, $element);

        return $newElement;
    }
659647
public function hasElement($name)
    {
        foreach($this->elements as $element){
            if($element->getName() == $name) {
                return true;
            }
        }

        return false;
    }
478429
public function setElementInsteadOf($targetName, $element, $name = null) {
		if (! isset($this->_elements[$targetName])) {
			return $this;
		}
		
		$elements = [];
		
		foreach ($this->_elements as $existsName => $existsElement) {
			
			if ($targetName === $existsName) {
				if ($name === null) {
					$elements[] = $element;
				} else {
					$elements[$name] = $element;
				}
			} else {
				$elements[$existsName] = $existsElement;
			}
		}
		
		$this->_elements = $elements;
		
		return $this;
	}
951590
public function &addElement($element, $args = [])
    {
        $element = $this->factory->create($element, $args);

        $this->elementFactory('factory', $element);

        return $element;
    }
547180
public function unsetElement($name)
    {
        if (isset($this->elements[$name])) {
            unset($this->elements[$name]);
        }

        return $this;
    }
801045
public function addInputCheckbox(string $name) : Element\Input\Checkbox
    {
        $input = new Element\Input\Checkbox($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }
13161
public function AddHeader($name, $enabled=true)
    {
        if(!isset($this->headers[$name]))
        {
            $header = new Element\Header($name, $enabled);

            $this->headers[$name] = $header;
        }
    }
857438
public function addInputHidden(string $name) : Element\Input\Hidden
    {
        $input = new Element\Input\Hidden($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }
546161
public function addClass($name)
    {
        foreach ($this as $node) {
            if ($node instanceof \DOMElement) {
                /** @var \DOMElement $node */
                $classes = preg_split('/\s+/s', $node->getAttribute('class'));
                $found = false;
                $count = count($classes);
                for ($i = 0; $i < $count; $i++) {
                    if ($classes[$i] == $name) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $classes[] = $name;
                    $node->setAttribute('class', trim(join(' ', $classes)));
                }
            }
        }
        return $this;
    }
888495
public function add($elements)
    {
        if (is_array($elements)) {
            foreach ($elements as $element) {
                $this->add($element);
            }
        } else {
            $this->collections->add($elements);
        }

        return $this;
    }
786716
protected function createElement($name)
    {
        if (isset($this->elements[$name])) {
            return $this->factory->createInlineElement($this->elements[$name]);
        }

        return $this->factory->createElement($name);
    }
1336046
public function addInputFile(string $name) : Element\Input\File
    {
        $this->setEnctypeMultipart();

        $input = new Element\Input\File($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }