Adds element to composite. Throws InvalidArgumentException if more than one FormStatus element is added.

@param Element $element
@return Element
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);
    }
374433
public function appendToHead($element)
    {
        // Check if the element is valid
        if (empty($element)) {
            throw new InvalidArgumentException('The element provided is empty.');
        }

        // Append element to head
        $this->getHead()->append($element);

        return $this;
    }
121076
public function addFormElement(array $element, $options = array())
    {
        if (array_key_exists($element['name'], $this->formElements)) {
            throw new \Exception('Form element "'.$element['name'].'" is already added, use replaceFormElement() or removeElement() instead');
        }
    	$this->formElements[$element['name']] = $element;
        if (!empty($options) && is_array($options)) {
            $this->formElementOptions[$element['name']] = $options;
        }
        return $this;
    }
183655
public function addElement(Element $element): Element
    {
        foreach ($this->notAllowedElements as $notAllowed) {
            if ($element instanceof $notAllowed) {
                $callerName = \str_replace([__NAMESPACE__, '\\'], '', \get_called_class());
                $notAllowedName = \str_replace([__NAMESPACE__, '\\'], '', $notAllowed);
                throw new InvalidArgumentException($callerName.' cannot contain '.$notAllowedName);
            }
        }
        $this->elements[] = $element;
        return $element;
    }
295295
public function addElement( tao_helpers_form_FormElement $element, $isSystem = false)
    {

		$elementPosition = -1;
		foreach($this->elements as $i => $elt){
			if($elt->getName() == $element->getName()){
				$elementPosition = $i;
				break;
			}
		}

		if($elementPosition >= 0){
			$this->elements[$elementPosition] = $element;
		}else{
			$this->elements[] = $element;
		}

		if ($isSystem) {
		    $this->systemElements[] = $element->getName();
        }


    }
1178647
public function validate_element( $element ) {
		$type = gettype( $element );
		$callable = $this->type === 'callable';
		$is_object = 'object' === $type;
		$loose_check = $this->type === 'object';

		// callable must be callable
		if ( $callable && ! is_callable( $element ) ) {
			throw new InvalidArgumentException( 'Item must be callable' );
		}

		// target isn't callable, object must be an instance of target
		if ( ! $loose_check && ! $callable && $is_object && ! is_a( $element, $this->type ) ) {
			throw new InvalidArgumentException( "Item is not type or subtype of $this->type" );
		}

		// a non callable, non object type should match the target string
		if ( ! $callable && ! $is_object && $type !== $this->type ) {
			throw new InvalidArgumentException( "Item is not of type: $this->type" );
		}
	}
865498
protected function assembleComponent($element)
    {
        $options   = $this->getOptions();
        $element   = parent::__invoke($element);
        $component = sprintf(
            '<div style="padding: 0;" class="input-append color %s" data-color="%s" data-color-format="%s">%s',
            $options['class'],
            $options['color'],
            $options['format'],
            $element
        ) . sprintf(
            '<span class="add-on"><i style="background-color: %s;"></i></span></div>',
            $options['color']
        );

        return $component;
    }
857933
protected function initFormElement(ElementInterface $element)
    {
        $this->name($element->getName())->type('text');

        $this->getElement()->addAttributes($element->getAttributes());

        $type = $element->getAttribute('type');

        if (null !== $type) {
            $this->type(strtolower($type));
        }

        $this->value($element->getValue());

        return $this;
    }
437721
public function addElement(Element $element)
    {
        if (!in_array($element, $this->elements, true)) {
            array_push($this->elements, $element);
        }
        return $this;
    }
109769
public function addElement($element, $name = null) {
		if ($name === null) {
			$this->_elements[] = $element;
		} else {
			$this->_elements[$name] = $element;
		}
		
		return $this;
	}
1283030
public function addElement(\Mmi\Navigation\NavigationConfigElement $element)
    {
        $this->_data[$element->getId()] = $element;
        return $this;
    }
155637
public function addElement(OrderElement $elements)
    {
        $this->elements[] = $elements;
        $elements->setOrder($this);

        return $this;
    }
120366
public function resolveElement(Element $element)
    {
        $elementtype = $this->elementService->findElementtype($element);

        return $this->resolveElementtype($elementtype);
    }
394232
public function add($element) : BagInterface
    {
        array_unshift($this->elements, $element);
        shuffle($this->elements);
        return $this;
    }
244875
public function addElement(BaseElement $element): ContainerElement
    {
        $element->parent = $this;
        $this->children[] = $element;
        if ($element instanceof ContainerElement) {
            return $element;
        }

        return $this;
    }
569735
public function formElement(IElement $element)
    {
        if ($element instanceof Textarea) {
            return $this->formTextarea($element);
        } elseif ($element instanceof Select) {
            return $this->formSelect($element);
        } elseif ($element instanceof Submit) {
            return $this->formInput($element);
        } elseif ($element instanceof Button) {
            // todo: is it right?
            throw new InvalidArgumentException("Button element should be rendered without Helper.");
        } else {
            return $this->formInput($element);
        }
    }
1210344
function removeElement($element)
    {
        if(get_class($element) !== $this->manager->getModel()){
            throw new InvalidArgumentException("This element is not compatible with this collection, it only support  ".$this->manager->getModel());
        }

        $key = array_search($element, $this->elements, true);

        if ($key !== false) {
            unset($this->elements[$key]);

            return true;
        }

        return false;
    }