Path: blob/master/src/view/form/control/AphrontFormSubmitControl.php
12262 views
<?php12final class AphrontFormSubmitControl extends AphrontFormControl {34private $buttons = array();5private $sigils = array();67public function addCancelButton($href, $label = null) {8if (!$label) {9$label = pht('Cancel');10}11$button = id(new PHUIButtonView())12->setTag('a')13->setHref($href)14->setText($label)15->setColor(PHUIButtonView::GREY);16$this->addButton($button);17return $this;18}1920public function addButton(PHUIButtonView $button) {21$this->buttons[] = $button;22return $this;23}2425public function addSigil($sigil) {26$this->sigils[] = $sigil;27return $this;28}2930protected function getCustomControlClass() {31return 'aphront-form-control-submit';32}3334protected function renderInput() {35$submit_button = null;36if ($this->getValue()) {3738if ($this->sigils) {39$sigils = $this->sigils;40} else {41$sigils = null;42}4344$submit_button = javelin_tag(45'button',46array(47'type' => 'submit',48'name' => '__submit__',49'sigil' => $sigils,50'disabled' => $this->getDisabled() ? 'disabled' : null,51),52$this->getValue());53}5455return array(56$submit_button,57$this->buttons,58);59}6061}626364