diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index 446576d89e..39ca6fdfde 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -235,12 +235,31 @@ abstract class PhabricatorController extends AphrontController { ->loadHandles(); } - protected function renderHandlesForPHIDs(array $phids) { + + /** + * Render a list of links to handles, identified by PHIDs. The handles must + * already be loaded. + * + * @param list List of PHIDs to render links to. + * @param string Style, one of "\n" (to put each item on its own line) + * or "," (to list items inline, separated by commas). + * @return string Rendered list of handle links. + */ + protected function renderHandlesForPHIDs(array $phids, $style = "\n") { + $style_map = array( + "\n" => '
', + ',' => ', ', + ); + + if (empty($style_map[$style])) { + throw new Exception("Unknown handle list style '{$style}'!"); + } + $items = array(); foreach ($phids as $phid) { $items[] = $this->getHandle($phid)->renderLink(); } - return implode('
', $items); + return implode($style_map[$style], $items); } protected function buildApplicationMenu() { diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 1878c343ee..28a769c7ea 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -445,7 +445,7 @@ final class ManiphestTaskDetailController extends ManiphestController { $view->addProperty( pht('Subscribers'), $task->getCCPHIDs() - ? $this->renderHandlesForPHIDs($task->getCCPHIDs()) + ? $this->renderHandlesForPHIDs($task->getCCPHIDs(), ',') : ''.pht('None').''); $view->addProperty( @@ -468,7 +468,7 @@ final class ManiphestTaskDetailController extends ManiphestController { $view->addProperty( pht('Projects'), $task->getProjectPHIDs() - ? $this->renderHandlesForPHIDs($task->getProjectPHIDs()) + ? $this->renderHandlesForPHIDs($task->getProjectPHIDs(), ',') : ''.pht('None').''); foreach ($aux_fields as $aux_field) {