Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editfield/PhabricatorEditField.php
| Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | abstract class PhabricatorEditField extends Phobject { | ||||
| public function setValue($value) { | public function setValue($value) { | ||||
| $this->hasValue = true; | $this->hasValue = true; | ||||
| $this->initialValue = $value; | $this->initialValue = $value; | ||||
| $this->value = $value; | $this->value = $value; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function generateTransaction( | |||||
| PhabricatorApplicationTransaction $xaction) { | |||||
| if (!$this->getTransactionType()) { | |||||
| return null; | |||||
| } | |||||
| $xaction | |||||
| ->setTransactionType($this->getTransactionType()) | |||||
| ->setNewValue($this->getValueForTransaction()); | |||||
| foreach ($this->metadata as $key => $value) { | |||||
| $xaction->setMetadataValue($key, $value); | |||||
| } | |||||
| return $xaction; | |||||
| } | |||||
| public function setMetadataValue($key, $value) { | public function setMetadataValue($key, $value) { | ||||
| $this->metadata[$key] = $value; | $this->metadata[$key] = $value; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getMetadata() { | public function getMetadata() { | ||||
| return $this->metadata; | return $this->metadata; | ||||
| } | } | ||||
| protected function getValueForTransaction() { | public function getValueForTransaction() { | ||||
| return $this->getValue(); | return $this->getValue(); | ||||
| } | } | ||||
| public function getTransactionType() { | public function getTransactionType() { | ||||
| return $this->transactionType; | return $this->transactionType; | ||||
| } | } | ||||
| public function setTransactionType($type) { | public function setTransactionType($type) { | ||||
| ▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | public function getEditTypeKey() { | ||||
| return $this->editTypeKey; | return $this->editTypeKey; | ||||
| } | } | ||||
| protected function newEditType() { | protected function newEditType() { | ||||
| return id(new PhabricatorSimpleEditType()) | return id(new PhabricatorSimpleEditType()) | ||||
| ->setValueType($this->getHTTPParameterType()->getTypeName()); | ->setValueType($this->getHTTPParameterType()->getTypeName()); | ||||
| } | } | ||||
| protected function getEditTransactionType() { | protected function getEditType() { | ||||
| $transaction_type = $this->getTransactionType(); | $transaction_type = $this->getTransactionType(); | ||||
| if ($transaction_type === null) { | if ($transaction_type === null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $type_key = $this->getEditTypeKey(); | $type_key = $this->getEditTypeKey(); | ||||
| return $this->newEditType() | return $this->newEditType() | ||||
| ->setEditType($type_key) | ->setEditType($type_key) | ||||
| ->setTransactionType($transaction_type) | ->setTransactionType($transaction_type) | ||||
| ->setDescription($this->getDescription()) | ->setDescription($this->getDescription()) | ||||
| ->setMetadata($this->getMetadata()); | ->setMetadata($this->getMetadata()); | ||||
| } | } | ||||
| public function getEditTransactionTypes() { | public function getConduitEditTypes() { | ||||
| $edit_type = $this->getEditTransactionType(); | $edit_type = $this->getEditType(); | ||||
| if ($edit_type === null) { | |||||
| return null; | |||||
| } | |||||
| return array($edit_type); | |||||
| } | |||||
| public function getWebEditTypes() { | |||||
| $edit_type = $this->getEditType(); | |||||
| if ($edit_type === null) { | if ($edit_type === null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return array($edit_type); | return array($edit_type); | ||||
| } | } | ||||
| } | } | ||||