Add a basic "harbormaster.step.edit" API method
[phabricator/blender.git] / src / view / form / control / AphrontFormSubmitControl.php
blob7e948bd135d3bc76b25489bf8473a78361542329
1 <?php
3 final class AphrontFormSubmitControl extends AphrontFormControl {
5 private $buttons = array();
6 private $sigils = array();
8 public function addCancelButton($href, $label = null) {
9 if (!$label) {
10 $label = pht('Cancel');
12 $button = id(new PHUIButtonView())
13 ->setTag('a')
14 ->setHref($href)
15 ->setText($label)
16 ->setColor(PHUIButtonView::GREY);
17 $this->addButton($button);
18 return $this;
21 public function addButton(PHUIButtonView $button) {
22 $this->buttons[] = $button;
23 return $this;
26 public function addSigil($sigil) {
27 $this->sigils[] = $sigil;
28 return $this;
31 protected function getCustomControlClass() {
32 return 'aphront-form-control-submit';
35 protected function renderInput() {
36 $submit_button = null;
37 if ($this->getValue()) {
39 if ($this->sigils) {
40 $sigils = $this->sigils;
41 } else {
42 $sigils = null;
45 $submit_button = javelin_tag(
46 'button',
47 array(
48 'type' => 'submit',
49 'name' => '__submit__',
50 'sigil' => $sigils,
51 'disabled' => $this->getDisabled() ? 'disabled' : null,
53 $this->getValue());
56 return array(
57 $submit_button,
58 $this->buttons,