public function addElement(Element $element) { if ($element instanceof Element) { $this->elements[$element->getName()] = $element; } else { throw new Exception('Element must be specified by string or Life\\Form\\Element instance'); } return $this; }
public function addElement(Element $element, $name = null, $options = null) { if ($element instanceof Element) { if (null === $name) { $name = $element->getName(); } $this->elements[$element->getAttrib('id')] = $element; } else { throw new Exception('Element must be specified by string or Life\\Form\\Element instance'); } $this->order[$name] = $this->elements[$name]->getOrder(); $this->orderUpdated = true; return $this; }