forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAphrontFormSubmitControl.php
48 lines (40 loc) · 1.02 KB
/
AphrontFormSubmitControl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
final class AphrontFormSubmitControl extends AphrontFormControl {
private $buttons = array();
public function addCancelButton($href, $label = null) {
if (!$label) {
$label = pht('Cancel');
}
$button = id(new PHUIButtonView())
->setTag('a')
->setHref($href)
->setText($label)
->setColor(PHUIButtonView::GREY);
$this->addButton($button);
return $this;
}
public function addButton(PHUIButtonView $button) {
$this->buttons[] = $button;
return $this;
}
protected function getCustomControlClass() {
return 'aphront-form-control-submit';
}
protected function renderInput() {
$submit_button = null;
if ($this->getValue()) {
$submit_button = phutil_tag(
'button',
array(
'type' => 'submit',
'name' => '__submit__',
'disabled' => $this->getDisabled() ? 'disabled' : null,
),
$this->getValue());
}
return array(
$submit_button,
$this->buttons,
);
}
}