From 726144b9955c92348e08683e66441d98cf443427 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 16 Sep 2013 16:04:18 -0700 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 2 + ...PhabricatorStandardCustomFieldRemarkup.php | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 6ff129d1bd..dee462fe3c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php new file mode 100644 index 0000000000..e39fc66fe1 --- /dev/null +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php @@ -0,0 +1,39 @@ +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); + } + +}