Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/field/PhabricatorCustomField.php
| Show All 29 Lines | abstract class PhabricatorCustomField extends Phobject { | ||||
| 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'; | const ROLE_HERALDACTION = 'herald.action'; | ||||
| const ROLE_EXPORT = 'export'; | |||||
| /* -( Building Applications with Custom Fields )--------------------------- */ | /* -( Building Applications with Custom Fields )--------------------------- */ | ||||
| /** | /** | ||||
| * @task apps | * @task apps | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | switch ($role) { | ||||
| return $this->shouldAppearInTransactionMail(); | return $this->shouldAppearInTransactionMail(); | ||||
| case self::ROLE_HERALD: | case self::ROLE_HERALD: | ||||
| return $this->shouldAppearInHerald(); | return $this->shouldAppearInHerald(); | ||||
| case self::ROLE_HERALDACTION: | case self::ROLE_HERALDACTION: | ||||
| return $this->shouldAppearInHeraldActions(); | return $this->shouldAppearInHeraldActions(); | ||||
| case self::ROLE_EDITENGINE: | case self::ROLE_EDITENGINE: | ||||
| return $this->shouldAppearInEditView() || | return $this->shouldAppearInEditView() || | ||||
| $this->shouldAppearInEditEngine(); | $this->shouldAppearInEditEngine(); | ||||
| case self::ROLE_EXPORT: | |||||
| return $this->shouldAppearInDataExport(); | |||||
| 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,047 Lines • ▼ Show 20 Lines | public function updateAbstractDocument( | ||||
| PhabricatorSearchAbstractDocument $document) { | PhabricatorSearchAbstractDocument $document) { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| return $this->proxy->updateAbstractDocument($document); | return $this->proxy->updateAbstractDocument($document); | ||||
| } | } | ||||
| return $document; | return $document; | ||||
| } | } | ||||
| /* -( Data Export )-------------------------------------------------------- */ | |||||
| public function shouldAppearInDataExport() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->shouldAppearInDataExport(); | |||||
| } | |||||
| try { | |||||
| $this->newExportFieldType(); | |||||
| return true; | |||||
| } catch (PhabricatorCustomFieldImplementationIncompleteException $ex) { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| public function newExportField() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->newExportField(); | |||||
| } | |||||
| return $this->newExportFieldType() | |||||
| ->setLabel($this->getFieldName()); | |||||
| } | |||||
| public function newExportData() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->newExportData(); | |||||
| } | |||||
| throw new PhabricatorCustomFieldImplementationIncompleteException($this); | |||||
| } | |||||
| protected function newExportFieldType() { | |||||
| if ($this->proxy) { | |||||
| return $this->proxy->newExportFieldType(); | |||||
| } | |||||
| throw new PhabricatorCustomFieldImplementationIncompleteException($this); | |||||
| } | |||||
| /* -( Conduit )------------------------------------------------------------ */ | /* -( Conduit )------------------------------------------------------------ */ | ||||
| /** | /** | ||||
| * @task conduit | * @task conduit | ||||
| */ | */ | ||||
| public function shouldAppearInConduitDictionary() { | public function shouldAppearInConduitDictionary() { | ||||
| if ($this->proxy) { | if ($this->proxy) { | ||||
| ▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines | |||||