1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 20:02:40 +01:00
phorge-phorge/src/applications/differential/customfield/DifferentialProjectReviewersField.php
Joshua Spence 36e2d02d6e phtize all the things
Summary: `pht`ize a whole bunch of strings in rP.

Test Plan: Intense eyeballing.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12797
2015-05-22 21:16:39 +10:00

69 lines
1.5 KiB
PHP

<?php
final class DifferentialProjectReviewersField
extends DifferentialCustomField {
public function getFieldKey() {
return 'differential:project-reviewers';
}
public function getFieldName() {
return pht('Project Reviewers');
}
public function getFieldDescription() {
return pht('Display project reviewers.');
}
public function shouldAppearInPropertyView() {
return true;
}
public function canDisableField() {
return false;
}
public function renderPropertyViewLabel() {
return $this->getFieldName();
}
public function getRequiredHandlePHIDsForPropertyView() {
return mpull($this->getProjectReviewers(), 'getReviewerPHID');
}
public function renderPropertyViewValue(array $handles) {
$reviewers = $this->getProjectReviewers();
if (!$reviewers) {
return null;
}
$view = id(new DifferentialReviewersView())
->setUser($this->getViewer())
->setReviewers($reviewers)
->setHandles($handles);
// TODO: Active diff stuff.
return $view;
}
private function getProjectReviewers() {
$reviewers = array();
foreach ($this->getObject()->getReviewerStatus() as $reviewer) {
if (!$reviewer->isUser()) {
$reviewers[] = $reviewer;
}
}
return $reviewers;
}
public function getProTips() {
return array(
pht(
'You can add a project as a subscriber or reviewer by writing '.
'"%s" in the appropriate field.',
'#projectname'),
);
}
}