Page MenuHomePhabricator

D17021.id40948.diff
No OneTemporary

D17021.id40948.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3452,6 +3452,7 @@
'PhabricatorProjectPanelController' => 'applications/project/controller/PhabricatorProjectPanelController.php',
'PhabricatorProjectPointsProfilePanel' => 'applications/project/profilepanel/PhabricatorProjectPointsProfilePanel.php',
'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php',
+ 'PhabricatorProjectProfilePanel' => 'applications/search/profilepanel/PhabricatorProjectProfilePanel.php',
'PhabricatorProjectProfilePanelEngine' => 'applications/project/engine/PhabricatorProjectProfilePanelEngine.php',
'PhabricatorProjectProjectHasMemberEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasMemberEdgeType.php',
'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php',
@@ -8565,6 +8566,7 @@
'PhabricatorProjectPanelController' => 'PhabricatorProjectController',
'PhabricatorProjectPointsProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
+ 'PhabricatorProjectProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorProjectProfilePanelEngine' => 'PhabricatorProfilePanelEngine',
'PhabricatorProjectProjectHasMemberEdgeType' => 'PhabricatorEdgeType',
'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType',
diff --git a/src/applications/search/profilepanel/PhabricatorProjectProfilePanel.php b/src/applications/search/profilepanel/PhabricatorProjectProfilePanel.php
new file mode 100644
--- /dev/null
+++ b/src/applications/search/profilepanel/PhabricatorProjectProfilePanel.php
@@ -0,0 +1,70 @@
+<?php
+
+final class PhabricatorProjectProfilePanel
+ extends PhabricatorProfilePanel {
+
+ const PANELKEY = 'project';
+
+ public function getPanelTypeIcon() {
+ return 'fa-briefcase';
+ }
+
+ public function getPanelTypeName() {
+ return pht('Project');
+ }
+
+ public function canAddToObject($object) {
+ return true;
+ }
+
+ public function getDisplayName(
+ PhabricatorProfilePanelConfiguration $config) {
+ $project = $this->getProject($config);
+
+ return $project->getName();
+ }
+
+ public function buildEditEngineFields(
+ PhabricatorProfilePanelConfiguration $config) {
+ return array(
+ id(new PhabricatorDatasourceEditField())
+ ->setKey('project')
+ ->setLabel(pht('Project'))
+ ->setDatasource(new PhabricatorProjectDatasource())
+ ->setSingleValue($config->getPanelProperty('project')),
+ );
+ }
+
+ private function getProject(
+ PhabricatorProfilePanelConfiguration $config) {
+ $viewer = $this->getViewer();
+ $phid = $config->getPanelProperty('project');
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($phid))
+ ->needImages(true)
+ ->executeOne();
+
+ return $project;
+ }
+
+ protected function newNavigationMenuItems(
+ PhabricatorProfilePanelConfiguration $config) {
+
+ $project = $this->getProject($config);
+
+ $picture = $project->getProfileImageURI();
+ $name = $project->getName();
+ $href = $project->getURI();
+
+ $item = $this->newItem()
+ ->setHref($href)
+ ->setName($name)
+ ->setProfileImage($picture);
+
+ return array(
+ $item,
+ );
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Oct 4 2025, 5:45 PM (14 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9132816
Default Alt Text
D17021.id40948.diff (3 KB)

Event Timeline