Page MenuHomec4science

PhabricatorProjectWikiProfilePanel.php
No OneTemporary

File Metadata

Created
Wed, Jun 19, 11:39

PhabricatorProjectWikiProfilePanel.php

<?php
final class PhabricatorProjectWikiProfileMenuItem
extends PhabricatorProfileMenuItem {
const MENUITEMKEY = 'project.wiki';
const MENUITEM_WIKI = 'project.wiki';
public function getMenuItemTypeName() {
return pht('Project Wiki');
}
private function getDefaultName() {
return pht('Wiki');
}
public function canMakeDefault(
PhabricatorProfileMenuItemConfiguration $config) {
return true;
}
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 newNavigationMenuItems(
PhabricatorProfileMenuItemConfiguration $config) {
$project = $config->getProfileObject();
$id = $project->getID();
$name = $this->getDisplayName($config);
$icon = 'fa-book';
$href = "/project/wiki/view/{$id}/";
$item = $this->newItem()
->setHref($href)
->setName($name)
->setIcon($icon);
return array(
$item,
);
}
}

Event Timeline