action = $action; return $this; } public function setMethod($method) { $this->method = $method; return $this; } public function setEncType($enc_type) { $this->encType = $enc_type; return $this; } public function render() { require_celerity_resource('aphront-form-view-css'); return phutil_render_tag( 'form', array( 'action' => $this->action, 'method' => $this->method, 'class' => 'aphront-form-view', 'enctype' => $this->encType, ), $this->renderDataInputs(). $this->renderChildren()); } private function renderDataInputs() { $data = $this->data + array( '__form__' => 1, ); $inputs = array(); foreach ($data as $key => $value) { $inputs[] = phutil_render_tag( 'input', array( 'type' => 'hidden', 'name' => $key, 'value' => $value, )); } return implode("\n", $inputs); } }