public function addField($field)
    {
        if (!$field instanceof Base) {
            throw new \InvalidArgumentException(
                "No valid object passed to Fieldset::addField(). " .
                "Object should be an instance of \\ValidFormBuilder\\Base.",
                E_ERROR
            );
        }

        $this->__fields->addObject($field);

        // Set parent element hard, overwrite if previously set.
        $field->setMeta("parent", $this, true);

        if ($field->isDynamic() && get_class($field) !== "ValidFormBuilder\\MultiField"
            && get_class($field) !== "ValidFormBuilder\\Area"
        ) {
            $objHidden = new Hidden($field->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array(
                "default" => 0,
                "dynamicCounter" => true
            ));

            $this->__fields->addObject($objHidden);

            $field->setDynamicCounter($objHidden);
        }
    }
public function addField($field)
    {
        if (!$field instanceof Base) {
            throw new \InvalidArgumentException(
                "No valid object passed to Fieldset::addField(). " .
                "Object should be an instance of \\ValidFormBuilder\\Base.",
                E_ERROR
            );
        }

        $this->__fields->addObject($field);

        // Set parent element hard, overwrite if previously set.
        $field->setMeta("parent", $this, true);

        if ($field->isDynamic() && get_class($field) !== "ValidFormBuilder\\MultiField"
            && get_class($field) !== "ValidFormBuilder\\Area"
        ) {
            $objHidden = new Hidden($field->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array(
                "default" => 0,
                "dynamicCounter" => true
            ));

            $this->__fields->addObject($objHidden);

            $field->setDynamicCounter($objHidden);
        }
    }
public function addField ( $ field ) { if ( ! $ field instanceof Base ) { throw new \ InvalidArgumentException ( "No valid object passed to Fieldset::addField(). " . "Object should be an instance of \\ValidFormBuilder\\Base." , E_ERROR ) ; } $ this -> __fields -> addObject ( $ field ) ; // Set parent element hard, overwrite if previously set. $ field -> setMeta ( "parent" , $ this , true ) ; if ( $ field -> isDynamic ( ) && get_class ( $ field ) !== "ValidFormBuilder\\MultiField" && get_class ( $ field ) !== "ValidFormBuilder\\Area" ) { $ objHidden = new Hidden ( $ field -> getId ( ) . "_dynamic" , ValidForm :: VFORM_INTEGER , array ( "default" => 0 , "dynamicCounter" => true ) ) ; $ this -> __fields -> addObject ( $ objHidden ) ; $ field -> setDynamicCounter ( $ objHidden ) ; } }
Add an object to the fiedset's elements collection

@param \ValidFormBuilder\Base $field The object to add
@throws \InvalidArgumentException if property passed to `addField()` is not an instance of Base
Add an object to the fiedset s elements collection