mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-24 07:42:40 +01:00
1888f61411
Summary: Initially the change is aimed to solve issue with line breaks being lost in projects descriptions. But it is done in a general place so line breaks behavior is more consistent all over the place. Test Plan: - Write a multiline description of the project, using single \n for line breakers. - View project details in project/view/X? Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D10014
69 lines
1.7 KiB
PHP
69 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorStandardCustomFieldRemarkup
|
|
extends PhabricatorStandardCustomField {
|
|
|
|
public function getFieldType() {
|
|
return 'remarkup';
|
|
}
|
|
|
|
public function renderEditControl(array $handles) {
|
|
return id(new PhabricatorRemarkupControl())
|
|
->setLabel($this->getFieldName())
|
|
->setName($this->getFieldKey())
|
|
->setCaption($this->getCaption())
|
|
->setValue($this->getFieldValue());
|
|
}
|
|
|
|
public function getStyleForPropertyView() {
|
|
return 'block';
|
|
}
|
|
|
|
public function renderPropertyViewValue(array $handles) {
|
|
$value = $this->getFieldValue();
|
|
|
|
if (!strlen($value)) {
|
|
return null;
|
|
}
|
|
|
|
// TODO: Once this stabilizes, it would be nice to let fields batch this.
|
|
// For now, an extra query here and there on object detail pages isn't the
|
|
// end of the world.
|
|
|
|
$viewer = $this->getViewer();
|
|
return PhabricatorMarkupEngine::renderOneObject(
|
|
id(new PhabricatorMarkupOneOff())
|
|
->setContent($value)
|
|
->setPReserveLinebreaks(true),
|
|
'default',
|
|
$viewer);
|
|
}
|
|
|
|
public function getApplicationTransactionTitle(
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
$author_phid = $xaction->getAuthorPHID();
|
|
|
|
// TODO: Expose fancy transactions.
|
|
|
|
return pht(
|
|
'%s edited %s.',
|
|
$xaction->renderHandleLink($author_phid),
|
|
$this->getFieldName());
|
|
}
|
|
|
|
public function shouldAppearInHerald() {
|
|
return true;
|
|
}
|
|
|
|
public function getHeraldFieldConditions() {
|
|
return array(
|
|
HeraldAdapter::CONDITION_CONTAINS,
|
|
HeraldAdapter::CONDITION_NOT_CONTAINS,
|
|
HeraldAdapter::CONDITION_IS,
|
|
HeraldAdapter::CONDITION_IS_NOT,
|
|
HeraldAdapter::CONDITION_REGEXP,
|
|
);
|
|
}
|
|
|
|
|
|
}
|