@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 85 lines 2.0 kB view raw
1<?php 2 3final class PhrictionDocumentEditEngine 4 extends PhabricatorEditEngine { 5 6 const ENGINECONST = 'phriction.document'; 7 8 public function isEngineConfigurable() { 9 return false; 10 } 11 12 public function getEngineName() { 13 return pht('Phriction Document'); 14 } 15 16 public function getSummaryHeader() { 17 return pht('Edit Phriction Document Configurations'); 18 } 19 20 public function getSummaryText() { 21 return pht('This engine is used to edit Phriction documents.'); 22 } 23 24 public function getEngineApplicationClass() { 25 return PhabricatorPhrictionApplication::class; 26 } 27 28 protected function newEditableObject() { 29 $viewer = $this->getViewer(); 30 return PhrictionDocument::initializeNewDocument( 31 $viewer, 32 '/'); 33 } 34 35 protected function newObjectQuery() { 36 return id(new PhrictionDocumentQuery()) 37 ->needContent(true); 38 } 39 40 protected function getObjectCreateTitleText($object) { 41 return pht('Create Document'); 42 } 43 44 protected function getObjectCreateButtonText($object) { 45 return pht('Create Document'); 46 } 47 48 protected function getObjectEditTitleText($object) { 49 return pht('Edit Document: %s', $object->getContent()->getTitle()); 50 } 51 52 protected function getObjectEditShortText($object) { 53 return pht('Edit Document'); 54 } 55 56 protected function getObjectCreateShortText() { 57 return pht('Create Document'); 58 } 59 60 protected function getObjectName() { 61 return pht('Document'); 62 } 63 64 protected function getEditorURI() { 65 return '/phriction/document/edit/'; 66 } 67 68 protected function getObjectCreateCancelURI($object) { 69 return '/phriction/document/'; 70 } 71 72 protected function getObjectViewURI($object) { 73 return $object->getURI(); 74 } 75 76 protected function getCreateNewObjectPolicy() { 77 // NOTE: For now, this engine is only to support commenting. 78 return PhabricatorPolicies::POLICY_NOONE; 79 } 80 81 protected function buildCustomEditFields($object) { 82 return array(); 83 } 84 85}