public function __construct($name, $attributes, $content) { C::guardIsString($name); C::guardEachAndKeys($attributes, "guardIsString", "guardIsString"); C::guardIfNotNull($content, "guardIsHTML"); $this->_name = $name; $this->_attributes = $attributes; $this->_content = $content; }
public function __construct($id, $action, $attrs, IFormlet $formlet) { if (!preg_match("#[a-zA-Z][a-zA-Z0-9_]+#", $id)) { throw new Exception("Form::__construct: '{$id}' can not be used as " . "id. Only use numbers and digits."); } C::guardIsFormlet($formlet); C::guardIsString($id); C::guardIsString($action); $attrs = Value::defaultTo($attrs, array()); C::guardEachAndKeys($attrs, "C::guardIsString", "C::guardIsString"); $this->_id = $id; $this->_input = null; $this->_result = null; $attrs["method"] = "post"; $attrs["action"] = $action; $formlet = $formlet->mapHTML(V::fn(function ($dict, $html) use($attrs) { return H::tag("form", $attrs, $html); })); $name_source = NameSource::instantiate($this->_id); $repr = $formlet->instantiate($name_source); $this->_builder = $repr["builder"]; $this->_collector = $repr["collector"]; }
public function __construct($attributes) { C::guardEachAndKeys($attributes, "guardIsString", "guardIsString"); $this->_attributes = $attributes; }