mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Implement a "remarkup" standard field type
Summary: See D7006, etc. This one's easy since exposing it to ApplicationSearch doesn't make much sense. Test Plan: See screenshots. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7008
This commit is contained in:
parent
e2a148b8f8
commit
726144b995
2 changed files with 41 additions and 0 deletions
|
@ -1639,6 +1639,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorStandardCustomFieldBool' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php',
|
||||
'PhabricatorStandardCustomFieldInt' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php',
|
||||
'PhabricatorStandardCustomFieldInterface' => 'infrastructure/customfield/interface/PhabricatorStandardCustomFieldInterface.php',
|
||||
'PhabricatorStandardCustomFieldRemarkup' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php',
|
||||
'PhabricatorStandardCustomFieldSelect' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php',
|
||||
'PhabricatorStandardCustomFieldText' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php',
|
||||
'PhabricatorStandardPageView' => 'view/page/PhabricatorStandardPageView.php',
|
||||
|
@ -3789,6 +3790,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorStandardCustomField' => 'PhabricatorCustomField',
|
||||
'PhabricatorStandardCustomFieldBool' => 'PhabricatorStandardCustomField',
|
||||
'PhabricatorStandardCustomFieldInt' => 'PhabricatorStandardCustomField',
|
||||
'PhabricatorStandardCustomFieldRemarkup' => 'PhabricatorStandardCustomField',
|
||||
'PhabricatorStandardCustomFieldSelect' => 'PhabricatorStandardCustomField',
|
||||
'PhabricatorStandardCustomFieldText' => 'PhabricatorStandardCustomField',
|
||||
'PhabricatorStandardPageView' => 'PhabricatorBarePageView',
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorStandardCustomFieldRemarkup
|
||||
extends PhabricatorStandardCustomField {
|
||||
|
||||
public function getFieldType() {
|
||||
return 'remarkup';
|
||||
}
|
||||
|
||||
public function renderEditControl() {
|
||||
return id(new PhabricatorRemarkupControl())
|
||||
->setLabel($this->getFieldName())
|
||||
->setName($this->getFieldKey())
|
||||
->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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue