Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/view/form/control/PHUIFormNumberControl.php
12256 views
1
<?php
2
3
final class PHUIFormNumberControl extends AphrontFormControl {
4
5
private $disableAutocomplete;
6
private $autofocus;
7
8
public function setDisableAutocomplete($disable_autocomplete) {
9
$this->disableAutocomplete = $disable_autocomplete;
10
return $this;
11
}
12
13
public function getDisableAutocomplete() {
14
return $this->disableAutocomplete;
15
}
16
17
public function setAutofocus($autofocus) {
18
$this->autofocus = $autofocus;
19
return $this;
20
}
21
22
public function getAutofocus() {
23
return $this->autofocus;
24
}
25
26
protected function getCustomControlClass() {
27
return 'phui-form-number';
28
}
29
30
protected function renderInput() {
31
if ($this->getDisableAutocomplete()) {
32
$autocomplete = 'off';
33
} else {
34
$autocomplete = null;
35
}
36
37
return javelin_tag(
38
'input',
39
array(
40
'type' => 'text',
41
'pattern' => '\d*',
42
'name' => $this->getName(),
43
'value' => $this->getValue(),
44
'disabled' => $this->getDisabled() ? 'disabled' : null,
45
'autocomplete' => $autocomplete,
46
'id' => $this->getID(),
47
'autofocus' => ($this->getAutofocus() ? 'autofocus' : null),
48
));
49
}
50
51
}
52
53