Differential D19810 Diff 47322 src/applications/transactions/editfield/PhabricatorApplyEditField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editfield/PhabricatorApplyEditField.php
| <?php | <?php | ||||
| final class PhabricatorApplyEditField | final class PhabricatorApplyEditField | ||||
| extends PhabricatorEditField { | extends PhabricatorEditField { | ||||
| private $actionDescription; | private $actionDescription; | ||||
| private $actionConflictKey; | private $actionConflictKey; | ||||
| private $actionSubmitButtonText; | |||||
| private $options; | private $options; | ||||
| protected function newControl() { | protected function newControl() { | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function setActionDescription($action_description) { | public function setActionDescription($action_description) { | ||||
| $this->actionDescription = $action_description; | $this->actionDescription = $action_description; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getActionDescription() { | public function getActionDescription() { | ||||
| return $this->actionDescription; | return $this->actionDescription; | ||||
| } | } | ||||
| public function setActionConflictKey($action_conflict_key) { | public function setActionConflictKey($action_conflict_key) { | ||||
| $this->actionConflictKey = $action_conflict_key; | $this->actionConflictKey = $action_conflict_key; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getActionConflictKey() { | public function getActionConflictKey() { | ||||
| return $this->actionConflictKey; | return $this->actionConflictKey; | ||||
| } | } | ||||
| public function setActionSubmitButtonText($text) { | |||||
| $this->actionSubmitButtonText = $text; | |||||
| return $this; | |||||
| } | |||||
| public function getActionSubmitButtonText() { | |||||
| return $this->actionSubmitButtonText; | |||||
| } | |||||
| public function setOptions(array $options) { | public function setOptions(array $options) { | ||||
| $this->options = $options; | $this->options = $options; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getOptions() { | public function getOptions() { | ||||
| return $this->options; | return $this->options; | ||||
| } | } | ||||
| Show All 14 Lines | public function shouldGenerateTransactionsFromSubmit() { | ||||
| // This type of edit field just applies a prebuilt action, like "Accept | // This type of edit field just applies a prebuilt action, like "Accept | ||||
| // Revision", and can not be submitted as part of an "Edit Object" form. | // Revision", and can not be submitted as part of an "Edit Object" form. | ||||
| return false; | return false; | ||||
| } | } | ||||
| protected function newCommentAction() { | protected function newCommentAction() { | ||||
| $options = $this->getOptions(); | $options = $this->getOptions(); | ||||
| if ($options) { | if ($options) { | ||||
| return id(new PhabricatorEditEngineCheckboxesCommentAction()) | $action = id(new PhabricatorEditEngineCheckboxesCommentAction()) | ||||
| ->setConflictKey($this->getActionConflictKey()) | |||||
| ->setOptions($options); | ->setOptions($options); | ||||
| } else { | } else { | ||||
| return id(new PhabricatorEditEngineStaticCommentAction()) | $action = id(new PhabricatorEditEngineStaticCommentAction()) | ||||
| ->setConflictKey($this->getActionConflictKey()) | |||||
| ->setDescription($this->getActionDescription()); | ->setDescription($this->getActionDescription()); | ||||
| } | } | ||||
| return $action | |||||
| ->setConflictKey($this->getActionConflictKey()) | |||||
| ->setSubmitButtonText($this->getActionSubmitButtonText()); | |||||
| } | } | ||||
| } | } | ||||