Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorSourceDocumentEngine.php
- This file was added.
<?php | |||||
final class PhabricatorSourceDocumentEngine | |||||
extends PhabricatorTextDocumentEngine { | |||||
const ENGINEKEY = 'source'; | |||||
public function getViewAsLabel(PhabricatorDocumentRef $ref) { | |||||
return pht('View as Source'); | |||||
} | |||||
protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | |||||
return 'fa-code'; | |||||
} | |||||
protected function getContentScore(PhabricatorDocumentRef $ref) { | |||||
return 1500; | |||||
} | |||||
protected function newDocumentContent(PhabricatorDocumentRef $ref) { | |||||
$content = $this->loadTextData($ref); | |||||
$content = PhabricatorSyntaxHighlighter::highlightWithFilename( | |||||
$ref->getName(), | |||||
$content); | |||||
return $this->newTextDocumentContent($content); | |||||
} | |||||
} |