Changeset View
Changeset View
Standalone View
Standalone View
src/applications/home/profilepanel/PhabricatorHomeManagePanel.php
- This file was added.
<?php | |||||
final class PhabricatorHomeManagePanel | |||||
extends PhabricatorProfilePanel { | |||||
const PANELKEY = 'home.manage.menu'; | |||||
public function getPanelTypeName() { | |||||
return pht('Manage Menu'); | |||||
} | |||||
private function getDefaultName() { | |||||
return pht('Manage'); | |||||
} | |||||
public function canHidePanel( | |||||
PhabricatorProfilePanelConfiguration $config) { | |||||
return false; | |||||
} | |||||
public function getDisplayName( | |||||
PhabricatorProfilePanelConfiguration $config) { | |||||
$name = $config->getPanelProperty('name'); | |||||
if (strlen($name)) { | |||||
return $name; | |||||
} | |||||
return $this->getDefaultName(); | |||||
} | |||||
public function buildEditEngineFields( | |||||
PhabricatorProfilePanelConfiguration $config) { | |||||
return array( | |||||
id(new PhabricatorTextEditField()) | |||||
->setKey('name') | |||||
->setLabel(pht('Name')) | |||||
->setPlaceholder($this->getDefaultName()) | |||||
->setValue($config->getPanelProperty('name')), | |||||
); | |||||
} | |||||
protected function newNavigationMenuItems( | |||||
PhabricatorProfilePanelConfiguration $config) { | |||||
$name = $this->getDisplayName($config); | |||||
$icon = 'fa-gears'; | |||||
$href = '/home/manage/'; | |||||
$item = $this->newItem() | |||||
->setHref($href) | |||||
->setName($name) | |||||
->setIcon($icon); | |||||
return array( | |||||
$item, | |||||
); | |||||
} | |||||
} |