@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 148 lines 4.6 kB view raw
1<?php 2 3final class PhortuneMerchantEditEngine 4 extends PhabricatorEditEngine { 5 6 const ENGINECONST = 'phortune.merchant'; 7 8 public function getEngineName() { 9 return pht('Phortune'); 10 } 11 12 public function getEngineApplicationClass() { 13 return PhabricatorPhortuneApplication::class; 14 } 15 16 public function getSummaryHeader() { 17 return pht('Configure Phortune Merchant Forms'); 18 } 19 20 public function getSummaryText() { 21 return pht('Configure creation and editing forms for Phortune Merchants.'); 22 } 23 24 protected function newEditableObject() { 25 return PhortuneMerchant::initializeNewMerchant($this->getViewer()); 26 } 27 28 protected function newObjectQuery() { 29 return new PhortuneMerchantQuery(); 30 } 31 32 protected function getObjectCreateTitleText($object) { 33 return pht('Create New Merchant'); 34 } 35 36 protected function getObjectEditTitleText($object) { 37 return pht('Edit Merchant: %s', $object->getName()); 38 } 39 40 protected function getObjectEditShortText($object) { 41 return $object->getName(); 42 } 43 44 protected function getObjectCreateShortText() { 45 return pht('Create Merchant'); 46 } 47 48 protected function getObjectName() { 49 return pht('Merchant'); 50 } 51 52 protected function getObjectCreateCancelURI($object) { 53 return $this->getApplication()->getApplicationURI('/'); 54 } 55 56 protected function getEditorURI() { 57 return $this->getApplication()->getApplicationURI('edit/'); 58 } 59 60 protected function getObjectViewURI($object) { 61 return $object->getDetailsURI(); 62 } 63 64 public function isEngineConfigurable() { 65 return false; 66 } 67 68 protected function getCreateNewObjectPolicy() { 69 return $this->getApplication()->getPolicy( 70 PhortuneMerchantCapability::CAPABILITY); 71 } 72 73 protected function buildCustomEditFields($object) { 74 $viewer = $this->getViewer(); 75 76 if ($this->getIsCreate()) { 77 $member_phids = array($viewer->getPHID()); 78 } else { 79 $member_phids = $object->getMemberPHIDs(); 80 } 81 82 return array( 83 id(new PhabricatorTextEditField()) 84 ->setKey('name') 85 ->setLabel(pht('Name')) 86 ->setDescription(pht('Merchant name.')) 87 ->setConduitTypeDescription(pht('New Merchant name.')) 88 ->setIsRequired(true) 89 ->setTransactionType( 90 PhortuneMerchantNameTransaction::TRANSACTIONTYPE) 91 ->setValue($object->getName()), 92 93 id(new PhabricatorUsersEditField()) 94 ->setKey('members') 95 ->setAliases(array('memberPHIDs', 'managerPHIDs')) 96 ->setLabel(pht('Managers')) 97 ->setUseEdgeTransactions(true) 98 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 99 ->setMetadataValue( 100 'edge:type', 101 PhortuneMerchantHasMemberEdgeType::EDGECONST) 102 ->setDescription(pht('Initial merchant managers.')) 103 ->setConduitDescription(pht('Set merchant managers.')) 104 ->setConduitTypeDescription(pht('New list of managers.')) 105 ->setInitialValue($object->getMemberPHIDs()) 106 ->setValue($member_phids), 107 108 id(new PhabricatorRemarkupEditField()) 109 ->setKey('description') 110 ->setLabel(pht('Description')) 111 ->setDescription(pht('Merchant description.')) 112 ->setConduitTypeDescription(pht('New merchant description.')) 113 ->setTransactionType( 114 PhortuneMerchantDescriptionTransaction::TRANSACTIONTYPE) 115 ->setValue($object->getDescription()), 116 117 id(new PhabricatorRemarkupEditField()) 118 ->setKey('contactInfo') 119 ->setLabel(pht('Contact Info')) 120 ->setDescription(pht('Merchant contact information.')) 121 ->setConduitTypeDescription(pht('Merchant contact information.')) 122 ->setTransactionType( 123 PhortuneMerchantContactInfoTransaction::TRANSACTIONTYPE) 124 ->setValue($object->getContactInfo()), 125 126 id(new PhabricatorTextEditField()) 127 ->setKey('invoiceEmail') 128 ->setLabel(pht('Invoice From Email')) 129 ->setDescription(pht('Email address invoices are sent from.')) 130 ->setConduitTypeDescription( 131 pht('Email address invoices are sent from.')) 132 ->setTransactionType( 133 PhortuneMerchantInvoiceEmailTransaction::TRANSACTIONTYPE) 134 ->setValue($object->getInvoiceEmail()), 135 136 id(new PhabricatorRemarkupEditField()) 137 ->setKey('invoiceFooter') 138 ->setLabel(pht('Invoice Footer')) 139 ->setDescription(pht('Footer on invoice forms.')) 140 ->setConduitTypeDescription(pht('Footer on invoice forms.')) 141 ->setTransactionType( 142 PhortuneMerchantInvoiceFooterTransaction::TRANSACTIONTYPE) 143 ->setValue($object->getInvoiceFooter()), 144 145 ); 146 } 147 148}