Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/field/PhabricatorCustomField.php
| <?php | <?php | ||||
| /** | /** | ||||
| * @task apps Building Applications with Custom Fields | * @task apps Building Applications with Custom Fields | ||||
| * @task core Core Properties and Field Identity | * @task core Core Properties and Field Identity | ||||
| * @task proxy Field Proxies | * @task proxy Field Proxies | ||||
| * @task context Contextual Data | * @task context Contextual Data | ||||
| * @task storage Field Storage | * @task storage Field Storage | ||||
| * @task edit Integration with Edit Views | * @task edit Integration with Edit Views | ||||
| * @task view Integration with Property Views | * @task view Integration with Property Views | ||||
| * @task list Integration with List views | * @task list Integration with List views | ||||
| * @task appsearch Integration with ApplicationSearch | * @task appsearch Integration with ApplicationSearch | ||||
| * @task appxaction Integration with ApplicationTransactions | * @task appxaction Integration with ApplicationTransactions | ||||
| * @task xactionmail Integration with Transaction Mail | |||||
| * @task globalsearch Integration with Global Search | * @task globalsearch Integration with Global Search | ||||
| */ | */ | ||||
| abstract class PhabricatorCustomField { | abstract class PhabricatorCustomField { | ||||
| private $viewer; | private $viewer; | ||||
| private $object; | private $object; | ||||
| private $proxy; | private $proxy; | ||||
| const ROLE_APPLICATIONTRANSACTIONS = 'ApplicationTransactions'; | const ROLE_APPLICATIONTRANSACTIONS = 'ApplicationTransactions'; | ||||
| const ROLE_TRANSACTIONMAIL = 'ApplicationTransactions.mail'; | |||||
| const ROLE_APPLICATIONSEARCH = 'ApplicationSearch'; | const ROLE_APPLICATIONSEARCH = 'ApplicationSearch'; | ||||
| 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'; | ||||
| ▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | switch ($role) { | ||||
| case self::ROLE_VIEW: | case self::ROLE_VIEW: | ||||
| return $this->shouldAppearInPropertyView(); | return $this->shouldAppearInPropertyView(); | ||||
| case self::ROLE_LIST: | case self::ROLE_LIST: | ||||
| return $this->shouldAppearInListView(); | return $this->shouldAppearInListView(); | ||||
| 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: | |||||
| return $this->shouldAppearInTransactionMail(); | |||||
| case self::ROLE_DEFAULT: | case self::ROLE_DEFAULT: | ||||
| return true; | return true; | ||||
| default: | default: | ||||
| throw new Exception("Unknown field role '{$role}'!"); | throw new Exception("Unknown field role '{$role}'!"); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 743 Lines • ▼ Show 20 Lines | public function buildApplicationTransactionMailBody( | ||||
| PhabricatorMetaMTAMailBody $body) { | PhabricatorMetaMTAMailBody $body) { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->buildApplicationTransactionMailBody($xaction, $body); | return $this->proxy->buildApplicationTransactionMailBody($xaction, $body); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| /* -( Transaction Mail )--------------------------------------------------- */ | |||||
| /** | |||||
| * @task xactionmail | |||||
| */ | |||||
| public function shouldAppearInTransactionMail() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->shouldAppearInTransactionMail(); | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /** | |||||
| * @task xactionmail | |||||
| */ | |||||
| public function updateTransactionMailBody( | |||||
| PhabricatorMetaMTAMailBody $body, | |||||
| PhabricatorApplicationTransactionEditor $editor, | |||||
| array $xactions) { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->updateTransactionMailBody($body, $editor, $xactions); | |||||
| } | |||||
| return; | |||||
| } | |||||
| /* -( Edit View )---------------------------------------------------------- */ | /* -( Edit View )---------------------------------------------------------- */ | ||||
| /** | /** | ||||
| * @task edit | * @task edit | ||||
| */ | */ | ||||
| public function shouldAppearInEditView() { | public function shouldAppearInEditView() { | ||||
| ▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines | |||||