Path: blob/master/src/applications/paste/editor/PhabricatorPasteEditEngine.php
12241 views
<?php12final class PhabricatorPasteEditEngine3extends PhabricatorEditEngine {45const ENGINECONST = 'paste.paste';67public function getEngineName() {8return pht('Pastes');9}1011public function getSummaryHeader() {12return pht('Configure Paste Forms');13}1415public function getSummaryText() {16return pht('Configure creation and editing forms in Paste.');17}1819public function getEngineApplicationClass() {20return 'PhabricatorPasteApplication';21}2223protected function newEditableObject() {24return PhabricatorPaste::initializeNewPaste($this->getViewer());25}2627protected function newObjectQuery() {28return id(new PhabricatorPasteQuery())29->needRawContent(true);30}3132protected function getObjectCreateTitleText($object) {33return pht('Create New Paste');34}3536protected function getObjectEditTitleText($object) {37return pht('Edit Paste: %s', $object->getTitle());38}3940protected function getObjectEditShortText($object) {41return $object->getMonogram();42}4344protected function getObjectCreateShortText() {45return pht('Create Paste');46}4748protected function getObjectName() {49return pht('Paste');50}5152protected function getCommentViewHeaderText($object) {53return pht('Eat Paste');54}5556protected function getCommentViewButtonText($object) {57return pht('Nom Nom Nom Nom Nom');58}5960protected function getObjectViewURI($object) {61return '/P'.$object->getID();62}6364protected function buildCustomEditFields($object) {65return array(66id(new PhabricatorTextEditField())67->setKey('title')68->setLabel(pht('Title'))69->setTransactionType(PhabricatorPasteTitleTransaction::TRANSACTIONTYPE)70->setDescription(pht('The title of the paste.'))71->setConduitDescription(pht('Retitle the paste.'))72->setConduitTypeDescription(pht('New paste title.'))73->setValue($object->getTitle()),74id(new PhabricatorDatasourceEditField())75->setKey('language')76->setLabel(pht('Language'))77->setTransactionType(78PhabricatorPasteLanguageTransaction::TRANSACTIONTYPE)79->setAliases(array('lang'))80->setIsCopyable(true)81->setDatasource(new PasteLanguageSelectDatasource())82->setDescription(83pht(84'Language used for syntax highlighting. By default, inferred '.85'from the title.'))86->setConduitDescription(87pht('Change language used for syntax highlighting.'))88->setConduitTypeDescription(pht('New highlighting language.'))89->setSingleValue($object->getLanguage()),90id(new PhabricatorTextAreaEditField())91->setKey('text')92->setLabel(pht('Text'))93->setTransactionType(94PhabricatorPasteContentTransaction::TRANSACTIONTYPE)95->setMonospaced(true)96->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)97->setDescription(pht('The main body text of the paste.'))98->setConduitDescription(pht('Change the paste content.'))99->setConduitTypeDescription(pht('New body content.'))100->setValue($object->getRawContent()),101id(new PhabricatorSelectEditField())102->setKey('status')103->setLabel(pht('Status'))104->setTransactionType(105PhabricatorPasteStatusTransaction::TRANSACTIONTYPE)106->setIsFormField(false)107->setOptions(PhabricatorPaste::getStatusNameMap())108->setDescription(pht('Active or archived status.'))109->setConduitDescription(pht('Active or archive the paste.'))110->setConduitTypeDescription(pht('New paste status constant.'))111->setValue($object->getStatus()),112);113}114115}116117118