Frontend\Core\Engine\Form::__construct PHP Method

__construct() public method

public __construct ( string $name, string $action = null, string $method = 'post', string $hash = null, boolean $useToken = true )
$name string Name of the form.
$action string The action (URL) whereto the form will be submitted, if not provided it will be auto generated.
$method string The method to use when submitting the form, default is POST.
$hash string The id of the anchor to append to the action-URL.
$useToken boolean Should we automagically add a form token?
    public function __construct($name, $action = null, $method = 'post', $hash = null, $useToken = true)
    {
        $this->URL = Model::getContainer()->get('url');
        $this->header = Model::getContainer()->get('header');
        $name = (string) $name;
        if ($hash !== null && mb_strlen($hash) > 0) {
            $hash = (string) $hash;
            // check if the # is present
            if ($hash[0] !== '#') {
                $hash = '#' . $hash;
            }
        } else {
            $hash = null;
        }
        $useToken = (bool) $useToken;
        $action = $action === null ? $this->URL->getQueryString() : (string) $action;
        // call the real form-class
        parent::__construct((string) $name, $action . $hash, $method, (bool) $useToken);
        // add default classes
        $this->setParameter('id', $name);
        $this->setParameter('class', 'forkForms submitWithLink');
    }