Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / view / form / PHUIFormLayoutView.php
blob682c6c62cf95f89de220197d0ed2b165a1d37b4d
1 <?php
3 /**
4 * This provides the layout of an AphrontFormView without actually providing
5 * the <form /> tag. Useful on its own for creating forms in other forms (like
6 * dialogs) or forms which aren't submittable.
7 */
8 final class PHUIFormLayoutView extends AphrontView {
10 private $classes = array();
11 private $fullWidth;
13 public function setFullWidth($width) {
14 $this->fullWidth = $width;
15 return $this;
18 public function addClass($class) {
19 $this->classes[] = $class;
20 return $this;
23 public function appendInstructions($text) {
24 return $this->appendChild(
25 phutil_tag(
26 'div',
27 array(
28 'class' => 'aphront-form-instructions',
30 $text));
33 public function appendRemarkupInstructions($remarkup) {
34 $view = id(new AphrontFormView())
35 ->setViewer($this->getViewer())
36 ->newInstructionsRemarkupView($remarkup);
38 return $this->appendInstructions($view);
41 public function render() {
42 $classes = $this->classes;
43 $classes[] = 'phui-form-view';
45 if ($this->fullWidth) {
46 $classes[] = 'phui-form-full-width';
49 return phutil_tag(
50 'div',
51 array(
52 'class' => implode(' ', $classes),
54 $this->renderChildren());