Exemple #1
0
	/**
	 * Add a given element to this form, (or group in this form).
	 * If the element as the "group" property, it will automatically be added to that respective group.
	 *
	 * @param       $element
	 * @param array $atts
	 */
	public function addElement($element, $atts = []){
		// Group support! :)
		if(isset($atts['group'])){
			$grouptype = isset($atts['grouptype']) ? $atts['grouptype'] : 'default';

			$this->getGroup( $atts['group'], $grouptype )->addElement($element, $atts);
		}
		elseif($element instanceof FormElement && $element->get('group')){
			$grouptype = $element->get('grouptype') ? $element->get('grouptype') : 'default';

			$this->getGroup( $element->get('group'), $grouptype )->addElement($element, $atts);
		}
		else{
			parent::addElement($element, $atts);
		}
	}