mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-16 00:38:38 +01:00
Summary: Depends on D20357. Ref T13275. Now that there's a stronger layer between "stuff in the database" and "stuff on the screen", these subclasses all need to emit intermediate objects instead of raw, HTML-producing view objects. This update is mostly mechanical. Test Plan: - Viewed Home, Favorites, Portals, User Profiles, Project Profiles. - Clicked each item on each menu/profile type. - Added every (I think?) type of item to a menu and clicked them all. - Grepped for obsolete symbols (`newNavigationMenuItems`, `willBuildNavigationItems`). Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13275 Differential Revision: https://secure.phabricator.com/D20358
76 lines
1.6 KiB
PHP
76 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class PhabricatorManageProfileMenuItem
|
|
extends PhabricatorProfileMenuItem {
|
|
|
|
const MENUITEMKEY = 'menu.manage';
|
|
|
|
public function getMenuItemTypeName() {
|
|
return pht('Manage Menu');
|
|
}
|
|
|
|
private function getDefaultName() {
|
|
return pht('Edit Menu');
|
|
}
|
|
|
|
public function getMenuItemTypeIcon() {
|
|
return 'fa-pencil';
|
|
}
|
|
|
|
public function canHideMenuItem(
|
|
PhabricatorProfileMenuItemConfiguration $config) {
|
|
return false;
|
|
}
|
|
|
|
public function canMakeDefault(
|
|
PhabricatorProfileMenuItemConfiguration $config) {
|
|
return false;
|
|
}
|
|
|
|
public function getDisplayName(
|
|
PhabricatorProfileMenuItemConfiguration $config) {
|
|
$name = $config->getMenuItemProperty('name');
|
|
|
|
if (strlen($name)) {
|
|
return $name;
|
|
}
|
|
|
|
return $this->getDefaultName();
|
|
}
|
|
|
|
public function buildEditEngineFields(
|
|
PhabricatorProfileMenuItemConfiguration $config) {
|
|
return array(
|
|
id(new PhabricatorTextEditField())
|
|
->setKey('name')
|
|
->setLabel(pht('Name'))
|
|
->setPlaceholder($this->getDefaultName())
|
|
->setValue($config->getMenuItemProperty('name')),
|
|
);
|
|
}
|
|
|
|
protected function newMenuItemViewList(
|
|
PhabricatorProfileMenuItemConfiguration $config) {
|
|
$viewer = $this->getViewer();
|
|
|
|
if (!$viewer->isLoggedIn()) {
|
|
return array();
|
|
}
|
|
|
|
$engine = $this->getEngine();
|
|
$uri = $engine->getItemURI('configure/');
|
|
|
|
$name = $this->getDisplayName($config);
|
|
$icon = 'fa-pencil';
|
|
|
|
$item = $this->newItemView()
|
|
->setURI($uri)
|
|
->setName($name)
|
|
->setIcon($icon);
|
|
|
|
return array(
|
|
$item,
|
|
);
|
|
}
|
|
|
|
}
|