Add a ManiaCode Element

@api
@param Element $element Element to add
@return static
437721
public function addElement(Element $element)
    {
        if (!in_array($element, $this->elements, true)) {
            array_push($this->elements, $element);
        }
        return $this;
    }
93320
public function addAssignment(AssignmentElement $element)
    {
        $element->setContainer($this);
        $this->getAssignments()->attach($element);

        return $this;
    }
949215
public function push(...$elements): self
    {
        foreach ($elements as $element) {
            $this->validate($element);

            $this->elements[] = $element;
        }

        return $this;
    }
53479
protected function add_used($element) {
        $newused = array();
        // Iterate over all the element useds, filling $newused and
        // observing the multiple setting
        foreach ($element->get_used() as $used) {
            if (!in_array($used, $this->get_used())) { // it's a new one, add to $newused array
                $newused[] = $used;
                $this->set_used(array_merge($this->get_used(), array($used))); // add to the optigroup used array
            } else { // it's an existing one, exception on multiple optigroups
                if ($this->multiple) {
                    throw new base_optigroup_exception('multiple_optigroup_duplicate_element', $used);
                }
            }
        }
        // Finally, inform about newused to the next grand(parent/optigroupelement)
        if ($newused && $this->get_parent()) {
            $element->set_used($newused); // Only about the newused
            $grandparent = $this->get_grandoptigroupelement_or_grandparent();
            $grandparent->check_and_set_used($element);
        }
    }
1022296
public function addCustomElement($element)
    {
        if (($colon = strpos($element, ':')) !== false) {
            $namespace = substr($element, 0, $colon);
            if (!$this->hasNamespace($namespace)) {
                throw new \InvalidArgumentException(sprintf('Unregistered namespace: %s', $namespace));
            }
        }

        $this->customElements[] = $element;

        return $this;
    }
59450
public function addAction(\FrenchFrogs\Form\Element\Element $element)
    {
        $element->setForm($this);
        $this->actions[$element->getName()] = $element;
        return $this;
    }
515526
public function addElement(Element $element): Element
    {
        if ($element instanceof FormStatus) {
            if ($this->hasStatus === true) {
                throw new InvalidArgumentException('Form can contain only one FormStatus element');
            }
            $this->hasStatus = true;
        }
        return parent::addElement($element);
    }
739153
public function addElement($element) {
		if ($element instanceof HtmlButtongroups) {
			$this->elements []=$element;
		} else {
			$this->getLastButtonGroup()->addElement($element);
		}
	}
83551
public function add($element)
    {
        if ($element instanceof TermQuery) {
            parent::add($element);
        } else {
            parent::add(
                (new TermQuery())
                    ->setValue($element)
            );
        }

        return $this;
    }
42308
public function setListElement(string $element): Breadcrumbs
    {
        $this->validateElement('allowedListElement', $element);

        $this->setOption('listElement', $element);

        return $this;
    }
453008
public function addElement($element) : SidebarBuilderEvent
    {
        if (!is_array($element)) {
            return $this;
        }

        if (!array_key_exists('key', $element)) {
            foreach ($element as $subElement) {
                $this->addElement($subElement);
            }
        } elseif (array_key_exists($element['key'], $this->sidebar['admin'])) {
            if (!array_key_exists('children', $element)) {
                throw new \UnexpectedValueException('no children found for key ' . $element['key']);
            }
            $this->sidebar['admin'][$element['key']]['children'] = array_merge($this->sidebar['admin'][$element['key']]['children'], $element['children']);
        } else {
            $this->sidebar['admin'][$element['key']] = $element;
        }

        return $this;
    }
760561
public function push($element)
    {
        // ask PHP to give me the next index
        // http://stackoverflow.com/q/3698743/2908724
        $this->array[] = 'probe';
        end($this->array);
        $next = key($this->array);
        unset($this->array[$next]);

        // hash that and store
        $this->set($next, $element);

        return $this;
    }
714494
public function replaceWith(Element $element) 
	{
		// if the element has a parent
		if ( ! empty($this->parent)) {
			$this->parent->replaceChild($this, $element);
		} else {
			throw new \BadMethodCallException(
				__METHOD__."() expects this element to have a parent element"
			);
		}
		
		return $this;
	}
1338534
public function prependChild(Element $element)
	{
		$this->beforeInsert($element);
		
		array_unshift($this->children, $element);
		
		$this->afterInsert();
		
		return $this;
	}
125861
public function addElements(array $elements): self
    {
        foreach ($elements as $element) {
            if ($element instanceof OpenGraphElement) {
                $this->elements[] = $element->toArray();
            }
        }

        return $this;
    }
935664
public function add(...$elements) : self
    {
        foreach ($elements as $element) {
            $this->elements[] = $element;
        }

        return $this;
    }
1284912
public function append($element) {
        $this->elements[] = $element;
        $this->fire(new ListCreateEvent($element, $this->count() - 1));
        return $this;
    }