Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorSettingsPanel.php
| Show All 11 Lines | |||||
| * @task config Panel Configuration | * @task config Panel Configuration | ||||
| * @task panel Panel Implementation | * @task panel Panel Implementation | ||||
| * @task internal Internals | * @task internal Internals | ||||
| */ | */ | ||||
| abstract class PhabricatorSettingsPanel extends Phobject { | abstract class PhabricatorSettingsPanel extends Phobject { | ||||
| private $user; | private $user; | ||||
| private $viewer; | private $viewer; | ||||
| private $controller; | |||||
| private $navigation; | |||||
| private $overrideURI; | private $overrideURI; | ||||
| public function setUser(PhabricatorUser $user) { | public function setUser(PhabricatorUser $user) { | ||||
| $this->user = $user; | $this->user = $user; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getUser() { | public function getUser() { | ||||
| return $this->user; | return $this->user; | ||||
| } | } | ||||
| public function setViewer(PhabricatorUser $viewer) { | public function setViewer(PhabricatorUser $viewer) { | ||||
| $this->viewer = $viewer; | $this->viewer = $viewer; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getViewer() { | public function getViewer() { | ||||
| return $this->viewer; | return $this->viewer; | ||||
| } | } | ||||
| public function setOverrideURI($override_uri) { | public function setOverrideURI($override_uri) { | ||||
| $this->overrideURI = $override_uri; | $this->overrideURI = $override_uri; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| final public function setController(PhabricatorController $controller) { | |||||
| $this->controller = $controller; | |||||
| return $this; | |||||
| } | |||||
| final public function getController() { | |||||
| return $this->controller; | |||||
| } | |||||
| final public function setNavigation(AphrontSideNavFilterView $navigation) { | |||||
| $this->navigation = $navigation; | |||||
| return $this; | |||||
| } | |||||
| final public function getNavigation() { | |||||
| return $this->navigation; | |||||
| } | |||||
| final public static function getAllPanels() { | |||||
| return id(new PhutilClassMapQuery()) | |||||
| ->setAncestorClass(__CLASS__) | |||||
| ->setUniqueMethod('getPanelKey') | |||||
| ->setSortMethod('getPanelSortKey') | |||||
| ->execute(); | |||||
| } | |||||
| /* -( Panel Configuration )------------------------------------------------ */ | /* -( Panel Configuration )------------------------------------------------ */ | ||||
| /** | /** | ||||
| * Return a unique string used in the URI to identify this panel, like | * Return a unique string used in the URI to identify this panel, like | ||||
| * "example". | * "example". | ||||
| * | * | ||||
| * @return string Unique panel identifier (used in URIs). | * @return string Unique panel identifier (used in URIs). | ||||
| * @task config | * @task config | ||||
| */ | */ | ||||
| abstract public function getPanelKey(); | public function getPanelKey() { | ||||
| return $this->getPhobjectClassConstant('PANELKEY'); | |||||
| } | |||||
| /** | /** | ||||
| * Return a human-readable description of the panel's contents, like | * Return a human-readable description of the panel's contents, like | ||||
| * "Example Settings". | * "Example Settings". | ||||
| * | * | ||||
| * @return string Human-readable panel name. | * @return string Human-readable panel name. | ||||
| * @task config | * @task config | ||||
| Show All 25 Lines | /* -( Panel Configuration )------------------------------------------------ */ | ||||
| * @task config | * @task config | ||||
| */ | */ | ||||
| public function isEnabled() { | public function isEnabled() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| /** | /** | ||||
| * You can use this callback to generate multiple similar panels which all | |||||
| * share the same implementation. For example, OAuth providers each have a | |||||
| * separate panel, but the implementation for each panel is the same. | |||||
| * | |||||
| * To generate multiple panels, build them here and return a list. By default, | |||||
| * the current panel (`$this`) is returned alone. For most panels, this | |||||
| * is the right implementation. | |||||
| * | |||||
| * @return list<PhabricatorSettingsPanel> Zero or more panels. | |||||
| * @task config | |||||
| */ | |||||
| public function buildPanels() { | |||||
| return array($this); | |||||
| } | |||||
| /** | |||||
| * Return true if this panel is available to administrators while editing | * Return true if this panel is available to administrators while editing | ||||
| * system agent accounts. | * system agent accounts. | ||||
| * | * | ||||
| * @return bool True to enable edit by administrators. | * @return bool True to enable edit by administrators. | ||||
| * @task config | * @task config | ||||
| */ | */ | ||||
| public function isEditableByAdministrators() { | public function isEditableByAdministrators() { | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||