mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Formalize and fully modularize settings panel groups
Summary: Ref T4103. Settings panels are grouped into categories of similar panels (like "Email" or "Sessions and Logs"). Currently, this is done informally, by just grouping and ordering by strings. This won't work well with translations, since it means the ordering is entirely dependent on the language order, so the first settings panel you see might be something irrelvant or confusing. We'd also potentially break third-party stuff by changing strings, but do so in a silent hard-to-detect way. Provide formal objects and modularize the panel groups completely. Test Plan: Verified all panels still appear properly and in the same groups and order. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4103 Differential Revision: https://secure.phabricator.com/D16020
This commit is contained in:
parent
2725fdf800
commit
eb673fd783
31 changed files with 240 additions and 75 deletions
|
@ -3371,14 +3371,21 @@ phutil_register_library_map(array(
|
|||
'PhabricatorSendGridConfigOptions' => 'applications/config/option/PhabricatorSendGridConfigOptions.php',
|
||||
'PhabricatorSessionsSettingsPanel' => 'applications/settings/panel/PhabricatorSessionsSettingsPanel.php',
|
||||
'PhabricatorSetting' => 'applications/settings/setting/PhabricatorSetting.php',
|
||||
'PhabricatorSettingsAccountPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsAccountPanelGroup.php',
|
||||
'PhabricatorSettingsAddEmailAction' => 'applications/settings/action/PhabricatorSettingsAddEmailAction.php',
|
||||
'PhabricatorSettingsAdjustController' => 'applications/settings/controller/PhabricatorSettingsAdjustController.php',
|
||||
'PhabricatorSettingsApplication' => 'applications/settings/application/PhabricatorSettingsApplication.php',
|
||||
'PhabricatorSettingsApplicationsPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsApplicationsPanelGroup.php',
|
||||
'PhabricatorSettingsAuthenticationPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsAuthenticationPanelGroup.php',
|
||||
'PhabricatorSettingsDeveloperPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsDeveloperPanelGroup.php',
|
||||
'PhabricatorSettingsEditController' => 'applications/settings/controller/PhabricatorSettingsEditController.php',
|
||||
'PhabricatorSettingsEditEngine' => 'applications/settings/editor/PhabricatorSettingsEditEngine.php',
|
||||
'PhabricatorSettingsEmailPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsEmailPanelGroup.php',
|
||||
'PhabricatorSettingsLogsPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsLogsPanelGroup.php',
|
||||
'PhabricatorSettingsMainController' => 'applications/settings/controller/PhabricatorSettingsMainController.php',
|
||||
'PhabricatorSettingsMainMenuBarExtension' => 'applications/settings/extension/PhabricatorSettingsMainMenuBarExtension.php',
|
||||
'PhabricatorSettingsPanel' => 'applications/settings/panel/PhabricatorSettingsPanel.php',
|
||||
'PhabricatorSettingsPanelGroup' => 'applications/settings/panelgroup/PhabricatorSettingsPanelGroup.php',
|
||||
'PhabricatorSettingsTimezoneController' => 'applications/settings/controller/PhabricatorSettingsTimezoneController.php',
|
||||
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
|
||||
'PhabricatorSetupCheckTestCase' => 'applications/config/check/__tests__/PhabricatorSetupCheckTestCase.php',
|
||||
|
@ -8125,14 +8132,21 @@ phutil_register_library_map(array(
|
|||
'PhabricatorSendGridConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorSessionsSettingsPanel' => 'PhabricatorSettingsPanel',
|
||||
'PhabricatorSetting' => 'Phobject',
|
||||
'PhabricatorSettingsAccountPanelGroup' => 'PhabricatorSettingsPanelGroup',
|
||||
'PhabricatorSettingsAddEmailAction' => 'PhabricatorSystemAction',
|
||||
'PhabricatorSettingsAdjustController' => 'PhabricatorController',
|
||||
'PhabricatorSettingsApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorSettingsApplicationsPanelGroup' => 'PhabricatorSettingsPanelGroup',
|
||||
'PhabricatorSettingsAuthenticationPanelGroup' => 'PhabricatorSettingsPanelGroup',
|
||||
'PhabricatorSettingsDeveloperPanelGroup' => 'PhabricatorSettingsPanelGroup',
|
||||
'PhabricatorSettingsEditController' => 'PhabricatorController',
|
||||
'PhabricatorSettingsEditEngine' => 'PhabricatorEditEngine',
|
||||
'PhabricatorSettingsEmailPanelGroup' => 'PhabricatorSettingsPanelGroup',
|
||||
'PhabricatorSettingsLogsPanelGroup' => 'PhabricatorSettingsPanelGroup',
|
||||
'PhabricatorSettingsMainController' => 'PhabricatorController',
|
||||
'PhabricatorSettingsMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
|
||||
'PhabricatorSettingsPanel' => 'Phobject',
|
||||
'PhabricatorSettingsPanelGroup' => 'Phobject',
|
||||
'PhabricatorSettingsTimezoneController' => 'PhabricatorController',
|
||||
'PhabricatorSetupCheck' => 'Phobject',
|
||||
'PhabricatorSetupCheckTestCase' => 'PhabricatorTestCase',
|
||||
|
|
|
@ -15,8 +15,8 @@ final class PhabricatorConduitTokensSettingsPanel
|
|||
return pht('Conduit API Tokens');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Sessions and Logs');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
|
|
|
@ -14,8 +14,8 @@ final class DiffusionSetPasswordSettingsPanel extends PhabricatorSettingsPanel {
|
|||
return pht('VCS Password');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Authentication');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorOAuthServerAuthorizationsSettingsPanel
|
|||
return pht('OAuth Authorizations');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Sessions and Logs');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
|
|
|
@ -80,7 +80,7 @@ final class PhabricatorSettingsMainController
|
|||
}
|
||||
|
||||
private function buildPanels() {
|
||||
$panels = PhabricatorSettingsPanel::getAllPanels();
|
||||
$panels = PhabricatorSettingsPanel::getAllDisplayPanels();
|
||||
|
||||
$result = array();
|
||||
foreach ($panels as $key => $panel) {
|
||||
|
@ -125,11 +125,12 @@ final class PhabricatorSettingsMainController
|
|||
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI($base_uri)));
|
||||
|
||||
$group = null;
|
||||
$group_key = null;
|
||||
foreach ($panels as $panel) {
|
||||
if ($panel->getPanelGroup() != $group) {
|
||||
if ($panel->getPanelGroupKey() != $group_key) {
|
||||
$group_key = $panel->getPanelGroupKey();
|
||||
$group = $panel->getPanelGroup();
|
||||
$nav->addLabel($group);
|
||||
$nav->addLabel($group->getPanelGroupName());
|
||||
}
|
||||
|
||||
$nav->addFilter($panel->getPanelKey(), $panel->getPanelName());
|
||||
|
|
|
@ -9,8 +9,8 @@ final class PhabricatorAccountSettingsPanel
|
|||
return pht('Account');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Account Information');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAccountPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEditableByAdministrators() {
|
||||
|
|
|
@ -14,12 +14,8 @@ final class PhabricatorActivitySettingsPanel extends PhabricatorSettingsPanel {
|
|||
return pht('Activity Logs');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Sessions and Logs');
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
return true;
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -16,8 +16,8 @@ final class PhabricatorConpherencePreferencesSettingsPanel
|
|||
return pht('Conpherence Preferences');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Application Settings');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -9,8 +9,8 @@ final class PhabricatorDateTimeSettingsPanel
|
|||
return pht('Date and Time');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Account Information');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAccountPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEditableByAdministrators() {
|
||||
|
|
|
@ -21,8 +21,8 @@ final class PhabricatorDesktopNotificationsSettingsPanel
|
|||
return pht('Desktop Notifications');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Application Settings');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorDeveloperPreferencesSettingsPanel
|
|||
return pht('Developer Settings');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Developer');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsDeveloperPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorDiffPreferencesSettingsPanel
|
|||
return pht('Diff Preferences');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Application Settings');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorDisplayPreferencesSettingsPanel
|
|||
return pht('Display Preferences');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Application Settings');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorEmailAddressesSettingsPanel
|
|||
return pht('Email Addresses');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Email');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEditableByAdministrators() {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorEmailFormatSettingsPanel
|
|||
return pht('Email Format');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Email');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEditableByAdministrators() {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorEmailPreferencesSettingsPanel
|
|||
return pht('Email Preferences');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Email');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEditableByAdministrators() {
|
||||
|
|
|
@ -11,12 +11,8 @@ final class PhabricatorExternalAccountsSettingsPanel
|
|||
return pht('External Accounts');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Authentication');
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
return true;
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorHomePreferencesSettingsPanel
|
|||
return pht('Home Page');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Application Settings');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsApplicationsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -11,8 +11,8 @@ final class PhabricatorMultiFactorSettingsPanel
|
|||
return pht('Multi-Factor Auth');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Authentication');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -10,8 +10,8 @@ final class PhabricatorPasswordSettingsPanel extends PhabricatorSettingsPanel {
|
|||
return pht('Password');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Authentication');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
|
|
|
@ -14,8 +14,8 @@ final class PhabricatorSSHKeysSettingsPanel extends PhabricatorSettingsPanel {
|
|||
return pht('SSH Public Keys');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Authentication');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
|
|
|
@ -10,8 +10,8 @@ final class PhabricatorSessionsSettingsPanel extends PhabricatorSettingsPanel {
|
|||
return pht('Sessions');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Sessions and Logs');
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* submits the form. By extending this class, you can add new settings
|
||||
* panels.
|
||||
*
|
||||
* NOTE: This stuff is new and might not be completely stable.
|
||||
*
|
||||
* @task config Panel Configuration
|
||||
* @task panel Panel Implementation
|
||||
* @task internal Internals
|
||||
|
@ -63,11 +61,38 @@ abstract class PhabricatorSettingsPanel extends Phobject {
|
|||
}
|
||||
|
||||
final public static function getAllPanels() {
|
||||
return id(new PhutilClassMapQuery())
|
||||
$panels = id(new PhutilClassMapQuery())
|
||||
->setAncestorClass(__CLASS__)
|
||||
->setUniqueMethod('getPanelKey')
|
||||
->setSortMethod('getPanelSortKey')
|
||||
->execute();
|
||||
return msortv($panels, 'getPanelOrderVector');
|
||||
}
|
||||
|
||||
final public static function getAllDisplayPanels() {
|
||||
$panels = array();
|
||||
$groups = PhabricatorSettingsPanelGroup::getAllPanelGroupsWithPanels();
|
||||
foreach ($groups as $group) {
|
||||
foreach ($group->getPanels() as $key => $panel) {
|
||||
$panels[$key] = $panel;
|
||||
}
|
||||
}
|
||||
|
||||
return $panels;
|
||||
}
|
||||
|
||||
final public function getPanelGroup() {
|
||||
$group_key = $this->getPanelGroupKey();
|
||||
|
||||
$groups = PhabricatorSettingsPanelGroup::getAllPanelGroupsWithPanels();
|
||||
$group = idx($groups, $group_key);
|
||||
if (!$group) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'No settings panel group with key "%s" exists!',
|
||||
$group_key));
|
||||
}
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,17 +122,12 @@ abstract class PhabricatorSettingsPanel extends Phobject {
|
|||
|
||||
|
||||
/**
|
||||
* Return a human-readable group name for this panel. For instance, if you
|
||||
* had several related panels like "Volume Settings" and
|
||||
* "Microphone Settings", you might put them in a group called "Audio".
|
||||
* Return a panel group key constant for this panel.
|
||||
*
|
||||
* When displayed, panels are grouped with other panels that have the same
|
||||
* group name.
|
||||
*
|
||||
* @return string Human-readable panel group name.
|
||||
* @return const Panel group key.
|
||||
* @task config
|
||||
*/
|
||||
abstract public function getPanelGroup();
|
||||
abstract public function getPanelGroupKey();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -192,11 +212,9 @@ abstract class PhabricatorSettingsPanel extends Phobject {
|
|||
* @return string Sortable key.
|
||||
* @task internal
|
||||
*/
|
||||
final public function getPanelSortKey() {
|
||||
return sprintf(
|
||||
'%s'.chr(255).'%s',
|
||||
$this->getPanelGroup(),
|
||||
$this->getPanelName());
|
||||
final public function getPanelOrderVector() {
|
||||
return id(new PhutilSortVector())
|
||||
->addString($this->getPanelName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,12 +10,8 @@ final class PhabricatorTokensSettingsPanel extends PhabricatorSettingsPanel {
|
|||
return pht('Temporary Tokens');
|
||||
}
|
||||
|
||||
public function getPanelGroup() {
|
||||
return pht('Sessions and Logs');
|
||||
}
|
||||
|
||||
public function isEnabled() {
|
||||
return true;
|
||||
public function getPanelGroupKey() {
|
||||
return PhabricatorSettingsLogsPanelGroup::PANELGROUPKEY;
|
||||
}
|
||||
|
||||
public function processRequest(AphrontRequest $request) {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSettingsAccountPanelGroup
|
||||
extends PhabricatorSettingsPanelGroup {
|
||||
|
||||
const PANELGROUPKEY = 'account';
|
||||
|
||||
public function getPanelGroupName() {
|
||||
return pht('Account');
|
||||
}
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSettingsApplicationsPanelGroup
|
||||
extends PhabricatorSettingsPanelGroup {
|
||||
|
||||
const PANELGROUPKEY = 'applications';
|
||||
|
||||
public function getPanelGroupName() {
|
||||
return pht('Applications');
|
||||
}
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSettingsAuthenticationPanelGroup
|
||||
extends PhabricatorSettingsPanelGroup {
|
||||
|
||||
const PANELGROUPKEY = 'authentication';
|
||||
|
||||
public function getPanelGroupName() {
|
||||
return pht('Authentication');
|
||||
}
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 300;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSettingsDeveloperPanelGroup
|
||||
extends PhabricatorSettingsPanelGroup {
|
||||
|
||||
const PANELGROUPKEY = 'developer';
|
||||
|
||||
public function getPanelGroupName() {
|
||||
return pht('Developer');
|
||||
}
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 400;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSettingsEmailPanelGroup
|
||||
extends PhabricatorSettingsPanelGroup {
|
||||
|
||||
const PANELGROUPKEY = 'email';
|
||||
|
||||
public function getPanelGroupName() {
|
||||
return pht('Email');
|
||||
}
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSettingsLogsPanelGroup
|
||||
extends PhabricatorSettingsPanelGroup {
|
||||
|
||||
const PANELGROUPKEY = 'logs';
|
||||
|
||||
public function getPanelGroupName() {
|
||||
return pht('Sessions and Logs');
|
||||
}
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 600;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorSettingsPanelGroup extends Phobject {
|
||||
|
||||
private $panels;
|
||||
|
||||
abstract public function getPanelGroupName();
|
||||
|
||||
protected function getPanelGroupOrder() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
final public function getPanelGroupOrderVector() {
|
||||
return id(new PhutilSortVector())
|
||||
->addInt($this->getPanelGroupOrder())
|
||||
->addString($this->getPanelGroupName());
|
||||
}
|
||||
|
||||
final public function getPanelGroupKey() {
|
||||
return $this->getPhobjectClassConstant('PANELGROUPKEY');
|
||||
}
|
||||
|
||||
final public static function getAllPanelGroups() {
|
||||
$groups = id(new PhutilClassMapQuery())
|
||||
->setAncestorClass(__CLASS__)
|
||||
->setUniqueMethod('getPanelGroupKey')
|
||||
->execute();
|
||||
|
||||
return msortv($groups, 'getPanelGroupOrderVector');
|
||||
}
|
||||
|
||||
final public static function getAllPanelGroupsWithPanels() {
|
||||
$groups = self::getAllPanelGroups();
|
||||
|
||||
$panels = PhabricatorSettingsPanel::getAllPanels();
|
||||
$panels = mgroup($panels, 'getPanelGroupKey');
|
||||
foreach ($groups as $key => $group) {
|
||||
$group->panels = idx($panels, $key, array());
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
public function getPanels() {
|
||||
return $this->panels;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue