Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editfield/PhabricatorEditField.php
| <?php | <?php | ||||
| abstract class PhabricatorEditField extends Phobject { | abstract class PhabricatorEditField extends Phobject { | ||||
| private $key; | private $key; | ||||
| private $viewer; | private $viewer; | ||||
| private $label; | private $label; | ||||
| private $aliases = array(); | private $aliases = array(); | ||||
| private $value; | private $value; | ||||
| private $hasValue = false; | private $hasValue = false; | ||||
| private $object; | private $object; | ||||
| private $transactionType; | private $transactionType; | ||||
| private $metadata = array(); | private $metadata = array(); | ||||
| private $description; | private $description; | ||||
| private $editTypeKey; | private $editTypeKey; | ||||
| private $isRequired; | |||||
| private $isLocked; | private $isLocked; | ||||
| private $isHidden; | private $isHidden; | ||||
| private $isPreview; | private $isPreview; | ||||
| private $isEditDefaults; | private $isEditDefaults; | ||||
| private $isSubmittedForm; | |||||
| private $controlError; | |||||
| private $isReorderable = true; | private $isReorderable = true; | ||||
| private $isDefaultable = true; | private $isDefaultable = true; | ||||
| private $isLockable = true; | private $isLockable = true; | ||||
| public function setKey($key) { | public function setKey($key) { | ||||
| $this->key = $key; | $this->key = $key; | ||||
| return $this; | return $this; | ||||
| ▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | abstract class PhabricatorEditField extends Phobject { | ||||
| public function getIsHidden() { | public function getIsHidden() { | ||||
| return $this->isHidden; | return $this->isHidden; | ||||
| } | } | ||||
| protected function newControl() { | protected function newControl() { | ||||
| throw new PhutilMethodNotImplementedException(); | throw new PhutilMethodNotImplementedException(); | ||||
| } | } | ||||
| public function setIsSubmittedForm($is_submitted) { | |||||
| $this->isSubmittedForm = $is_submitted; | |||||
| return $this; | |||||
| } | |||||
| public function getIsSubmittedForm() { | |||||
| return $this->isSubmittedForm; | |||||
| } | |||||
| public function setIsRequired($is_required) { | |||||
| $this->isRequired = $is_required; | |||||
| return $this; | |||||
| } | |||||
| public function getIsRequired() { | |||||
| return $this->isRequired; | |||||
| } | |||||
| public function setControlError($control_error) { | |||||
| $this->controlError = $control_error; | |||||
| return $this; | |||||
| } | |||||
| public function getControlError() { | |||||
| return $this->controlError; | |||||
| } | |||||
| protected function renderControl() { | protected function renderControl() { | ||||
| $control = $this->newControl(); | $control = $this->newControl(); | ||||
| if ($control === null) { | if ($control === null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $control | $control | ||||
| ->setValue($this->getValueForControl()) | ->setValue($this->getValueForControl()) | ||||
| Show All 15 Lines | protected function renderControl() { | ||||
| } | } | ||||
| if ($hidden) { | if ($hidden) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $control->setDisabled($disabled); | $control->setDisabled($disabled); | ||||
| if ($this->getIsSubmittedForm()) { | |||||
| $error = $this->getControlError(); | |||||
| if ($error !== null) { | |||||
| $control->setError($error); | |||||
| } | |||||
| } else if ($this->getIsRequired()) { | |||||
| $control->setError(true); | |||||
| } | |||||
| return $control; | return $control; | ||||
| } | } | ||||
| public function appendToForm(AphrontFormView $form) { | public function appendToForm(AphrontFormView $form) { | ||||
| $control = $this->renderControl(); | $control = $this->renderControl(); | ||||
| if ($control !== null) { | if ($control !== null) { | ||||
| if ($this->getIsPreview()) { | if ($this->getIsPreview()) { | ||||
| ▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines | |||||