inputs[] = array($key, $value); return $this; } public function setUser(PhabricatorUser $user) { $this->user = $user; return $this; } public function setSubmitURI($uri) { $this->uri = $uri; return $this; } public function setTitle($title) { $this->title = $title; return $this; } public function setOnRight($on_right) { $this->onRight = $on_right; $this->addHiddenInput('on_right', $on_right); return $this; } public function render() { if (!$this->uri) { throw new Exception("Call setSubmitURI() before render()!"); } if (!$this->user) { throw new Exception("Call setUser() before render()!"); } $content = ''.phabricator_render_form( $this->user, array( 'action' => $this->uri, 'method' => 'POST', 'sigil' => 'inline-edit-form', ), $this->renderInputs(). $this->renderBody()).''; $other = ''; if ($this->onRight) { $core = $other.$content; } else { $core = $content.$other; } return ''.$core.'
'; } private function renderInputs() { $out = array(); foreach ($this->inputs as $input) { list($name, $value) = $input; $out[] = phutil_render_tag( 'input', array( 'type' => 'hidden', 'name' => $name, 'value' => $value, ), null); } return implode('', $out); } private function renderBody() { $buttons = array(); $buttons[] = ''; $buttons[] = javelin_render_tag( 'button', array( 'sigil' => 'inline-edit-cancel', 'class' => 'grey', ), 'Cancel'); $buttons = implode('', $buttons); return '
'. '
'. phutil_escape_html($this->title). '
'. '
'. $this->renderChildren(). '
'. '
'. $buttons. '
'. '
'. '
'; } }