Path: blob/master/src/applications/legalpad/storage/LegalpadDocumentBody.php
13459 views
<?php12final class LegalpadDocumentBody extends LegalpadDAO3implements4PhabricatorMarkupInterface {56const MARKUP_FIELD_TEXT = 'markup:text ';78protected $phid;9protected $creatorPHID;10protected $documentPHID;11protected $version;12protected $title;13protected $text;1415protected function getConfiguration() {16return array(17self::CONFIG_AUX_PHID => true,18self::CONFIG_COLUMN_SCHEMA => array(19'version' => 'uint32',20'title' => 'text255',21'text' => 'text?',22),23self::CONFIG_KEY_SCHEMA => array(24'key_document' => array(25'columns' => array('documentPHID', 'version'),26'unique' => true,27),28),29) + parent::getConfiguration();30}3132public function generatePHID() {33return PhabricatorPHID::generateNewPHID(34PhabricatorPHIDConstants::PHID_TYPE_LEGB);35}3637/* -( PhabricatorMarkupInterface )----------------------------------------- */383940public function getMarkupFieldKey($field) {41$content = $this->getMarkupText($field);42return PhabricatorMarkupEngine::digestRemarkupContent($this, $content);43}4445public function newMarkupEngine($field) {46return PhabricatorMarkupEngine::newMarkupEngine(array());47}4849public function getMarkupText($field) {50switch ($field) {51case self::MARKUP_FIELD_TEXT:52$text = $this->getText();53break;54default:55throw new Exception(pht('Unknown field: %s', $field));56break;57}5859return $text;60}6162public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {63require_celerity_resource('phabricator-remarkup-css');64return phutil_tag(65'div',66array(67'class' => 'phabricator-remarkup',68),69$output);70}7172public function shouldUseMarkupCache($field) {73return (bool)$this->getID();74}7576}777879