Path: blob/master/src/applications/files/editor/PhabricatorFileEditEngine.php
12242 views
<?php12final class PhabricatorFileEditEngine3extends PhabricatorEditEngine {45const ENGINECONST = 'files.file';67public function getEngineName() {8return pht('Files');9}1011protected function supportsEditEngineConfiguration() {12return false;13}1415protected function getCreateNewObjectPolicy() {16// TODO: For now, this EditEngine can only edit objects, since there is17// a lot of complexity in dealing with file data during file creation.18return PhabricatorPolicies::POLICY_NOONE;19}2021public function getSummaryHeader() {22return pht('Configure Files Forms');23}2425public function getSummaryText() {26return pht('Configure creation and editing forms in Files.');27}2829public function getEngineApplicationClass() {30return 'PhabricatorFilesApplication';31}3233protected function newEditableObject() {34return PhabricatorFile::initializeNewFile();35}3637protected function newObjectQuery() {38$query = new PhabricatorFileQuery();39$query->withIsDeleted(false);40return $query;41}4243protected function getObjectCreateTitleText($object) {44return pht('Create New File');45}4647protected function getObjectEditTitleText($object) {48return pht('Edit File: %s', $object->getName());49}5051protected function getObjectEditShortText($object) {52return $object->getMonogram();53}5455protected function getObjectCreateShortText() {56return pht('Create File');57}5859protected function getObjectName() {60return pht('File');61}6263protected function getObjectViewURI($object) {64return $object->getURI();65}6667protected function buildCustomEditFields($object) {68return array(69id(new PhabricatorTextEditField())70->setKey('name')71->setLabel(pht('Name'))72->setTransactionType(PhabricatorFileNameTransaction::TRANSACTIONTYPE)73->setDescription(pht('The name of the file.'))74->setConduitDescription(pht('Rename the file.'))75->setConduitTypeDescription(pht('New file name.'))76->setValue($object->getName()),77id(new PhabricatorTextEditField())78->setKey('alt')79->setLabel(pht('Alt Text'))80->setTransactionType(PhabricatorFileAltTextTransaction::TRANSACTIONTYPE)81->setDescription(pht('Human-readable file description.'))82->setConduitDescription(pht('Set the file alt text.'))83->setConduitTypeDescription(pht('New alt text.'))84->setValue($object->getCustomAltText()),85);86}8788}899091