Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editfield/PhabricatorEditField.php
Show All 23 Lines | abstract class PhabricatorEditField extends Phobject { | ||||
private $isEditDefaults; | private $isEditDefaults; | ||||
private $isSubmittedForm; | private $isSubmittedForm; | ||||
private $controlError; | private $controlError; | ||||
private $isReorderable = true; | private $isReorderable = true; | ||||
private $isDefaultable = true; | private $isDefaultable = true; | ||||
private $isLockable = true; | private $isLockable = true; | ||||
private $isCopyable = false; | private $isCopyable = false; | ||||
private $isConduitOnly = false; | |||||
public function setKey($key) { | public function setKey($key) { | ||||
$this->key = $key; | $this->key = $key; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getKey() { | public function getKey() { | ||||
return $this->key; | return $this->key; | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | public function setIsReorderable($is_reorderable) { | ||||
$this->isReorderable = $is_reorderable; | $this->isReorderable = $is_reorderable; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getIsReorderable() { | public function getIsReorderable() { | ||||
return $this->isReorderable; | return $this->isReorderable; | ||||
} | } | ||||
public function setIsConduitOnly($is_conduit_only) { | |||||
$this->isConduitOnly = $is_conduit_only; | |||||
return $this; | |||||
} | |||||
public function getIsConduitOnly() { | |||||
return $this->isConduitOnly; | |||||
} | |||||
public function setIsEditDefaults($is_edit_defaults) { | public function setIsEditDefaults($is_edit_defaults) { | ||||
$this->isEditDefaults = $is_edit_defaults; | $this->isEditDefaults = $is_edit_defaults; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getIsEditDefaults() { | public function getIsEditDefaults() { | ||||
return $this->isEditDefaults; | return $this->isEditDefaults; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | public function getCommentActionLabel() { | ||||
return $this->commentActionLabel; | return $this->commentActionLabel; | ||||
} | } | ||||
protected function newControl() { | protected function newControl() { | ||||
throw new PhutilMethodNotImplementedException(); | throw new PhutilMethodNotImplementedException(); | ||||
} | } | ||||
protected function buildControl() { | protected function buildControl() { | ||||
if ($this->getIsConduitOnly()) { | |||||
return null; | |||||
} | |||||
$control = $this->newControl(); | $control = $this->newControl(); | ||||
if ($control === null) { | if ($control === null) { | ||||
return null; | return null; | ||||
} | } | ||||
$control | $control | ||||
->setValue($this->getValueForControl()) | ->setValue($this->getValueForControl()) | ||||
->setName($this->getKey()); | ->setName($this->getKey()); | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | protected function getDefaultValue() { | ||||
if ($type) { | if ($type) { | ||||
return $type->getDefaultValue(); | return $type->getDefaultValue(); | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
final public function getHTTPParameterType() { | final public function getHTTPParameterType() { | ||||
if ($this->getIsConduitOnly()) { | |||||
return null; | |||||
} | |||||
$type = $this->newHTTPParameterType(); | $type = $this->newHTTPParameterType(); | ||||
if ($type) { | if ($type) { | ||||
$type->setViewer($this->getViewer()); | $type->setViewer($this->getViewer()); | ||||
} | } | ||||
return $type; | return $type; | ||||
} | } | ||||
Show All 10 Lines | abstract class PhabricatorEditField extends Phobject { | ||||
public function getEditTypeKey() { | public function getEditTypeKey() { | ||||
if ($this->editTypeKey === null) { | if ($this->editTypeKey === null) { | ||||
return $this->getKey(); | return $this->getKey(); | ||||
} | } | ||||
return $this->editTypeKey; | return $this->editTypeKey; | ||||
} | } | ||||
protected function newEditType() { | protected function newEditType() { | ||||
// TODO: This could be a little cleaner. | |||||
$http_type = $this->getHTTPParameterType(); | |||||
if ($http_type) { | |||||
$value_type = $http_type->getTypeName(); | |||||
} else { | |||||
$value_type = 'wild'; | |||||
} | |||||
return id(new PhabricatorSimpleEditType()) | return id(new PhabricatorSimpleEditType()) | ||||
->setValueType($this->getHTTPParameterType()->getTypeName()); | ->setValueType($value_type); | ||||
} | } | ||||
protected function getEditType() { | protected function getEditType() { | ||||
$transaction_type = $this->getTransactionType(); | $transaction_type = $this->getTransactionType(); | ||||
if ($transaction_type === null) { | if ($transaction_type === null) { | ||||
return null; | return null; | ||||
} | } | ||||
Show All 13 Lines | public function getConduitEditTypes() { | ||||
if ($edit_type === null) { | if ($edit_type === null) { | ||||
return array(); | return array(); | ||||
} | } | ||||
return array($edit_type); | return array($edit_type); | ||||
} | } | ||||
public function getWebEditTypes() { | public function getWebEditTypes() { | ||||
if ($this->getIsConduitOnly()) { | |||||
return array(); | |||||
} | |||||
$edit_type = $this->getEditType(); | $edit_type = $this->getEditType(); | ||||
if ($edit_type === null) { | if ($edit_type === null) { | ||||
return array(); | return array(); | ||||
} | } | ||||
return array($edit_type); | return array($edit_type); | ||||
} | } | ||||
public function getCommentEditTypes() { | public function getCommentEditTypes() { | ||||
return array(); | return array(); | ||||
} | } | ||||
} | } |