/** * __construct function. * * Create a new form. * * @param string $action * @param Closure $closure. (default: NULL) * @param string $method. (default: 'POST') * @return void */ function __construct($action, Closure $closure = NULL, $method = 'POST') { $this->elements = new BFArray(); $this->allowedMethods = new BFArray('DELETE', 'GET', 'POST', 'PUT'); // register the basics $this->action = $action; $this->method = $this->allowedMethods->contains(strtoupper($method)) ? $method : 'POST'; $this->name = CAP::makeID(); // set our form scope CAP::setScope($this->name); // register the form closure $this->makeElement('hidden', $this->name, $closure, $this->name); }