2013-09-17 01:04:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorStandardCustomFieldRemarkup
|
|
|
|
extends PhabricatorStandardCustomField {
|
|
|
|
|
|
|
|
public function getFieldType() {
|
|
|
|
return 'remarkup';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderEditControl() {
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderPropertyViewValue() {
|
|
|
|
$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),
|
|
|
|
'default',
|
|
|
|
$viewer);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|