public function add($name, $type = 'text', array $options = [], $modify = false)
    {
        if (!$name || trim($name) == '') {
            throw new \InvalidArgumentException(
                'Please provide valid field name for class ['. get_class($this) .']'
            );
        }

        if ($this->rebuilding && !$this->has($name)) {
            return $this;
        }

        $this->addField($this->makeField($name, $type, $options), $modify);

        return $this;
    }
public function add($name, $type = 'text', array $options = [], $modify = false)
    {
        if (!$name || trim($name) == '') {
            throw new \InvalidArgumentException(
                'Please provide valid field name for class ['. get_class($this) .']'
            );
        }

        if ($this->rebuilding && !$this->has($name)) {
            return $this;
        }

        $this->addField($this->makeField($name, $type, $options), $modify);

        return $this;
    }
public function add ( $ name , $ type = 'text' , array $ options = [ ] , $ modify = false ) { if ( ! $ name || trim ( $ name ) == '' ) { throw new \ InvalidArgumentException ( 'Please provide valid field name for class [' . get_class ( $ this ) . ']' ) ; } if ( $ this -> rebuilding && ! $ this -> has ( $ name ) ) { return $ this ; } $ this -> addField ( $ this -> makeField ( $ name , $ type , $ options ) , $ modify ) ; return $ this ; }
Create a new field and add it to the form

@param string $name
@param string $type
@param array  $options
@param bool   $modify
@return $this
Create a new field and add it to the form