3 final class PhabricatorFileEditEngine
4 extends PhabricatorEditEngine
{
6 const ENGINECONST
= 'files.file';
8 public function getEngineName() {
12 protected function supportsEditEngineConfiguration() {
16 protected function getCreateNewObjectPolicy() {
17 // TODO: For now, this EditEngine can only edit objects, since there is
18 // a lot of complexity in dealing with file data during file creation.
19 return PhabricatorPolicies
::POLICY_NOONE
;
22 public function getSummaryHeader() {
23 return pht('Configure Files Forms');
26 public function getSummaryText() {
27 return pht('Configure creation and editing forms in Files.');
30 public function getEngineApplicationClass() {
31 return 'PhabricatorFilesApplication';
34 protected function newEditableObject() {
35 return PhabricatorFile
::initializeNewFile();
38 protected function newObjectQuery() {
39 $query = new PhabricatorFileQuery();
40 $query->withIsDeleted(false);
44 protected function getObjectCreateTitleText($object) {
45 return pht('Create New File');
48 protected function getObjectEditTitleText($object) {
49 return pht('Edit File: %s', $object->getName());
52 protected function getObjectEditShortText($object) {
53 return $object->getMonogram();
56 protected function getObjectCreateShortText() {
57 return pht('Create File');
60 protected function getObjectName() {
64 protected function getObjectViewURI($object) {
65 return $object->getURI();
68 protected function buildCustomEditFields($object) {
70 id(new PhabricatorTextEditField())
72 ->setLabel(pht('Name'))
73 ->setTransactionType(PhabricatorFileNameTransaction
::TRANSACTIONTYPE
)
74 ->setDescription(pht('The name of the file.'))
75 ->setConduitDescription(pht('Rename the file.'))
76 ->setConduitTypeDescription(pht('New file name.'))
77 ->setValue($object->getName()),
78 id(new PhabricatorTextEditField())
80 ->setLabel(pht('Alt Text'))
81 ->setTransactionType(PhabricatorFileAltTextTransaction
::TRANSACTIONTYPE
)
82 ->setDescription(pht('Human-readable file description.'))
83 ->setConduitDescription(pht('Set the file alt text.'))
84 ->setConduitTypeDescription(pht('New alt text.'))
85 ->setValue($object->getCustomAltText()),