@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Label MenuItem

Summary: Ref T12174, lets you set labels as well for dividing content.

Test Plan: Add a label, review on homepage.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12174

Differential Revision: https://secure.phabricator.com/D17278

+77
+2
src/__phutil_library_map__.php
··· 2882 2882 'PhabricatorKeyring' => 'applications/files/keyring/PhabricatorKeyring.php', 2883 2883 'PhabricatorKeyringConfigOptionType' => 'applications/files/keyring/PhabricatorKeyringConfigOptionType.php', 2884 2884 'PhabricatorLDAPAuthProvider' => 'applications/auth/provider/PhabricatorLDAPAuthProvider.php', 2885 + 'PhabricatorLabelProfileMenuItem' => 'applications/search/menuitem/PhabricatorLabelProfileMenuItem.php', 2885 2886 'PhabricatorLegalpadApplication' => 'applications/legalpad/application/PhabricatorLegalpadApplication.php', 2886 2887 'PhabricatorLegalpadConfigOptions' => 'applications/legalpad/config/PhabricatorLegalpadConfigOptions.php', 2887 2888 'PhabricatorLegalpadDocumentPHIDType' => 'applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php', ··· 7938 7939 'PhabricatorKeyring' => 'Phobject', 7939 7940 'PhabricatorKeyringConfigOptionType' => 'PhabricatorConfigJSONOptionType', 7940 7941 'PhabricatorLDAPAuthProvider' => 'PhabricatorAuthProvider', 7942 + 'PhabricatorLabelProfileMenuItem' => 'PhabricatorProfileMenuItem', 7941 7943 'PhabricatorLegalpadApplication' => 'PhabricatorApplication', 7942 7944 'PhabricatorLegalpadConfigOptions' => 'PhabricatorApplicationConfigOptions', 7943 7945 'PhabricatorLegalpadDocumentPHIDType' => 'PhabricatorPHIDType',
+75
src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
··· 1 + <?php 2 + 3 + final class PhabricatorLabelProfileMenuItem 4 + extends PhabricatorProfileMenuItem { 5 + 6 + const MENUITEMKEY = 'label'; 7 + const FIELD_NAME = 'name'; 8 + 9 + public function getMenuItemTypeIcon() { 10 + return 'fa-map-signs'; 11 + } 12 + 13 + public function getMenuItemTypeName() { 14 + return pht('Label'); 15 + } 16 + 17 + public function canAddToObject($object) { 18 + return true; 19 + } 20 + 21 + public function getDisplayName( 22 + PhabricatorProfileMenuItemConfiguration $config) { 23 + return $this->getLabelName($config); 24 + } 25 + 26 + public function buildEditEngineFields( 27 + PhabricatorProfileMenuItemConfiguration $config) { 28 + return array( 29 + id(new PhabricatorTextEditField()) 30 + ->setKey(self::FIELD_NAME) 31 + ->setLabel(pht('Name')) 32 + ->setIsRequired(true) 33 + ->setValue($this->getLabelName($config)), 34 + ); 35 + } 36 + 37 + private function getLabelName( 38 + PhabricatorProfileMenuItemConfiguration $config) { 39 + return $config->getMenuItemProperty('name'); 40 + } 41 + 42 + protected function newNavigationMenuItems( 43 + PhabricatorProfileMenuItemConfiguration $config) { 44 + 45 + $name = $this->getLabelName($config); 46 + 47 + $item = $this->newItem() 48 + ->setName($name) 49 + ->setType(PHUIListItemView::TYPE_LABEL); 50 + 51 + return array( 52 + $item, 53 + ); 54 + } 55 + 56 + public function validateTransactions( 57 + PhabricatorProfileMenuItemConfiguration $config, 58 + $field_key, 59 + $value, 60 + array $xactions) { 61 + 62 + $viewer = $this->getViewer(); 63 + $errors = array(); 64 + 65 + if ($field_key == self::FIELD_NAME) { 66 + if ($this->isEmptyTransaction($value, $xactions)) { 67 + $errors[] = $this->newRequiredError( 68 + pht('You must choose a label name.'), 69 + $field_key); 70 + } 71 + } 72 + 73 + return $errors; 74 + } 75 + }