Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / view / control / AphrontTypeaheadTemplateView.php
blobe536a7a7cfc22674ae80a35cd30a8d15d00b0395
1 <?php
3 final class AphrontTypeaheadTemplateView extends AphrontView {
5 private $value;
6 private $name;
7 private $id;
9 public function setID($id) {
10 $this->id = $id;
11 return $this;
14 public function setValue(array $value) {
15 $this->value = $value;
16 return $this;
19 public function getValue() {
20 return $this->value;
23 public function setName($name) {
24 $this->name = $name;
25 return $this;
28 public function getName() {
29 return $this->name;
32 public function render() {
33 require_celerity_resource('aphront-typeahead-control-css');
35 $id = $this->id;
36 $name = $this->getName();
37 $values = nonempty($this->getValue(), array());
39 $tokens = array();
40 foreach ($values as $key => $value) {
41 $tokens[] = $this->renderToken($key, $value);
44 $input = javelin_tag(
45 'input',
46 array(
47 'name' => $name,
48 'class' => 'jx-typeahead-input',
49 'sigil' => 'typeahead',
50 'type' => 'text',
51 'value' => $this->value,
52 'autocomplete' => 'off',
53 ));
55 return javelin_tag(
56 'div',
57 array(
58 'id' => $id,
59 'sigil' => 'typeahead-hardpoint',
60 'class' => 'jx-typeahead-hardpoint',
62 array(
63 $input,
64 phutil_tag('div', array('style' => 'clear: both'), ''),
65 ));