2013-09-17 01:04:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorStandardCustomFieldRemarkup
|
|
|
|
extends PhabricatorStandardCustomField {
|
|
|
|
|
|
|
|
public function getFieldType() {
|
|
|
|
return 'remarkup';
|
|
|
|
}
|
|
|
|
|
2014-02-21 20:53:37 +01:00
|
|
|
public function renderEditControl(array $handles) {
|
2013-09-17 01:04:18 +02:00
|
|
|
return id(new PhabricatorRemarkupControl())
|
|
|
|
->setLabel($this->getFieldName())
|
|
|
|
->setName($this->getFieldKey())
|
2013-09-18 19:12:24 +02:00
|
|
|
->setCaption($this->getCaption())
|
2013-09-17 01:04:18 +02:00
|
|
|
->setValue($this->getFieldValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getStyleForPropertyView() {
|
|
|
|
return 'block';
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
public function renderPropertyViewValue(array $handles) {
|
2013-09-17 01:04:18 +02:00
|
|
|
$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(
|
2014-07-25 22:11:41 +02:00
|
|
|
id(new PhabricatorMarkupOneOff())
|
|
|
|
->setContent($value)
|
|
|
|
->setPReserveLinebreaks(true),
|
2013-09-17 01:04:18 +02:00
|
|
|
'default',
|
|
|
|
$viewer);
|
|
|
|
}
|
|
|
|
|
2013-09-22 01:23:17 +02:00
|
|
|
public function getApplicationTransactionTitle(
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
$author_phid = $xaction->getAuthorPHID();
|
|
|
|
|
|
|
|
// TODO: Expose fancy transactions.
|
|
|
|
|
|
|
|
return pht(
|
|
|
|
'%s edited %s.',
|
|
|
|
$xaction->renderHandleLink($author_phid),
|
|
|
|
$this->getFieldName());
|
|
|
|
}
|
|
|
|
|
2014-04-04 03:43:49 +02:00
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-09-22 01:23:17 +02:00
|
|
|
|
2013-09-17 01:04:18 +02:00
|
|
|
}
|