1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-26 06:28:19 +01:00
phorge-phorge/src/view/form/control/AphrontFormSubmitControl.php
epriestley 17dee98d32 Add a one-click "Scuttle Task" button to Maniphest
Summary: Fixes T4657. See that task for discussion of edge cases.

Test Plan: {F132941}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: chad, carl, epriestley

Maniphest Tasks: T4657

Differential Revision: https://secure.phabricator.com/D8590
2014-03-25 14:20:25 -07:00

45 lines
905 B
PHP

<?php
final class AphrontFormSubmitControl extends AphrontFormControl {
private $cancelButton;
public function addCancelButton($href, $label = null) {
if (!$label) {
$label = pht('Cancel');
}
$this->cancelButton = phutil_tag(
'a',
array(
'href' => $href,
'class' => 'button grey',
),
$label);
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->cancelButton,
);
}
}