Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/field/PhabricatorCustomField.php
| Show All 28 Lines | abstract class PhabricatorCustomField extends Phobject { | ||||
| 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'; | const ROLE_EDITENGINE = 'EditEngine'; | ||||
| const ROLE_HERALDACTION = 'herald.action'; | |||||
| /* -( 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_HERALDACTION: | |||||
| return $this->shouldAppearInHeraldActions(); | |||||
| case self::ROLE_EDITENGINE: | case self::ROLE_EDITENGINE: | ||||
| return $this->shouldAppearInEditView() || | return $this->shouldAppearInEditView() || | ||||
| $this->shouldAppearInEditEngine(); | $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 1,167 Lines • ▼ Show 20 Lines | /* -( Herald )------------------------------------------------------------- */ | ||||
| public function getHeraldDatasource() { | public function getHeraldDatasource() { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->getHeraldDatasource(); | return $this->proxy->getHeraldDatasource(); | ||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function shouldAppearInHeraldActions() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->shouldAppearInHeraldActions(); | |||||
| } | |||||
| return false; | |||||
| } | |||||
amckinley: What do all these `if ($proxy)` checks accomplish, and why do we only do a real check if the… | |||||
| public function getHeraldActionName() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->getHeraldActionName(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public function getHeraldActionStandardType() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->getHeraldActionStandardType(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public function getHeraldActionDescription($value) { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->getHeraldActionDescription($value); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public function getHeraldActionEffectDescription($value) { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->getHeraldActionEffectDescription($value); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public function getHeraldActionDatasource() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->getHeraldActionDatasource(); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
What do all these if ($proxy) checks accomplish, and why do we only do a real check if the object has a proxy?