Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/field/PhabricatorCustomField.php
| Show All 27 Lines | abstract class PhabricatorCustomField extends Phobject { | ||||
| const ROLE_STORAGE = 'storage'; | const ROLE_STORAGE = 'storage'; | ||||
| const ROLE_DEFAULT = 'default'; | const ROLE_DEFAULT = 'default'; | ||||
| const ROLE_EDIT = 'edit'; | const ROLE_EDIT = 'edit'; | ||||
| const ROLE_VIEW = 'view'; | const ROLE_VIEW = 'view'; | ||||
| const ROLE_LIST = 'list'; | const ROLE_LIST = 'list'; | ||||
| const ROLE_GLOBALSEARCH = 'GlobalSearch'; | const ROLE_GLOBALSEARCH = 'GlobalSearch'; | ||||
| const ROLE_CONDUIT = 'conduit'; | const ROLE_CONDUIT = 'conduit'; | ||||
| const ROLE_HERALD = 'herald'; | const ROLE_HERALD = 'herald'; | ||||
| const ROLE_EDITENGINE = 'EditEngine'; | |||||
| /* -( Building Applications with Custom Fields )--------------------------- */ | /* -( Building Applications with Custom Fields )--------------------------- */ | ||||
| /** | /** | ||||
| * @task apps | * @task apps | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 243 Lines • ▼ Show 20 Lines | switch ($role) { | ||||
| case self::ROLE_GLOBALSEARCH: | case self::ROLE_GLOBALSEARCH: | ||||
| return $this->shouldAppearInGlobalSearch(); | return $this->shouldAppearInGlobalSearch(); | ||||
| case self::ROLE_CONDUIT: | case self::ROLE_CONDUIT: | ||||
| return $this->shouldAppearInConduitDictionary(); | return $this->shouldAppearInConduitDictionary(); | ||||
| case self::ROLE_TRANSACTIONMAIL: | case self::ROLE_TRANSACTIONMAIL: | ||||
| return $this->shouldAppearInTransactionMail(); | return $this->shouldAppearInTransactionMail(); | ||||
| case self::ROLE_HERALD: | case self::ROLE_HERALD: | ||||
| return $this->shouldAppearInHerald(); | return $this->shouldAppearInHerald(); | ||||
| case self::ROLE_EDITENGINE: | |||||
| return $this->shouldAppearInEditView() || | |||||
| $this->shouldAppearInEditEngine(); | |||||
| case self::ROLE_DEFAULT: | case self::ROLE_DEFAULT: | ||||
| return true; | return true; | ||||
| default: | default: | ||||
| throw new Exception(pht("Unknown field role '%s'!", $role)); | throw new Exception(pht("Unknown field role '%s'!", $role)); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 812 Lines • ▼ Show 20 Lines | protected function newEditField() { | ||||
| return $field; | return $field; | ||||
| } | } | ||||
| protected function newStandardEditField() { | protected function newStandardEditField() { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->newStandardEditField(); | return $this->proxy->newStandardEditField(); | ||||
| } | } | ||||
| if (!$this->shouldAppearInEditView()) { | |||||
| $conduit_only = true; | |||||
| } else { | |||||
| $conduit_only = false; | |||||
| } | |||||
| return $this->newEditField() | return $this->newEditField() | ||||
| ->setKey($this->getFieldKey()) | ->setKey($this->getFieldKey()) | ||||
| ->setEditTypeKey($this->getModernFieldKey()) | ->setEditTypeKey($this->getModernFieldKey()) | ||||
| ->setLabel($this->getFieldName()) | ->setLabel($this->getFieldName()) | ||||
| ->setDescription($this->getFieldDescription()) | ->setDescription($this->getFieldDescription()) | ||||
| ->setTransactionType($this->getApplicationTransactionType()) | ->setTransactionType($this->getApplicationTransactionType()) | ||||
| ->setIsConduitOnly($conduit_only) | |||||
| ->setValue($this->getNewValueForApplicationTransactions()); | ->setValue($this->getNewValueForApplicationTransactions()); | ||||
| } | } | ||||
| protected function getHTTPParameterType() { | protected function getHTTPParameterType() { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->getHTTPParameterType(); | return $this->proxy->getHTTPParameterType(); | ||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| /** | /** | ||||
| * @task edit | * @task edit | ||||
| */ | */ | ||||
| public function shouldAppearInEditView() { | public function shouldAppearInEditView() { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->shouldAppearInEditView(); | return $this->proxy->shouldAppearInEditView(); | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | |||||
| * @task edit | |||||
| */ | |||||
| public function shouldAppearInEditEngine() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->shouldAppearInEditEngine(); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /** | /** | ||||
| * @task edit | * @task edit | ||||
| */ | */ | ||||
| public function readValueFromRequest(AphrontRequest $request) { | public function readValueFromRequest(AphrontRequest $request) { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->readValueFromRequest($request); | return $this->proxy->readValueFromRequest($request); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 302 Lines • Show Last 20 Lines | |||||